How to disable right click and text selection

Disable right click and text selection It is possible with javascript to disable right click and text selection to avoid the text from being copied. Sometimes due to some rules you may need to disable the right click and text selection. Below script will help you to achieve your goal.

Published
Categorized as JavaScript

HTML5 default validation for confirm password

Hello guys, In this section, I am going to show you how you can easily validating HTML5 default validation for confirm the password. Generally in HTML5 when you create a form you simply write “required” attribute to the form element and it starts validating itself without other javascript code. But for confirm password validation you… Continue reading HTML5 default validation for confirm password

Published
Categorized as JavaScript

Nested Loop javascript

Simple nested loop javascript code var person = [{ name : [ {firstName: “Ravi”, lastName: “Kumar”} ], id : 5566 },{ name: [ {firstName: “John”, lastName: “Braman”} ], id : 96 }]; var item, text; text=”<table class=’stack’>”; text+=”<thead><tr><th>First Name</th><th>Last Name</th><th>id</th></tr>”; for(var i=0; i<person.length; i++) { for(var j=0; j<person[i].name.length; j++) { text += “<tr><td>”+person[i].name[j].firstName+”</td><td>”+person[i].name[j].lastName+”</td>”+”<td>”+person[i].id+”</td></tr>”; } }… Continue reading Nested Loop javascript

Published
Categorized as JavaScript

Basic simple calculator

In this tutorial I am going to show you how to design a basic simple calculator with few HTML codes. Generally building of calculator seems to be very hard work and lots of code. But it is not true when we have powerful markup language like HTML (Hyper Text Markup Language). It requires some few… Continue reading Basic simple calculator

Published
Categorized as JavaScript

javascript function keyboard key

With javascript we can control the function of keyboard key. Its necessary sometimes when we have to create an event on clicking some specific key. In this post we are going to learn how to handle javascript funciton keyboard key. How to use javascript function keyboard key <script type=”text/javascript”> document.onkeydown = function (e) {  … Continue reading javascript function keyboard key

Published
Categorized as JavaScript

javascript redirect code

With below javascript redirect code, you can easily redirect your current page to any pages you desire. Simple Javascript redirect code copy and paste it into your page where you want to redirect on load. <script type=”text/javascript”> window.location = “http://example.com/” </script>

Published
Categorized as JavaScript

Compare identical array

How to compare identical array var userOrder = [“sort_one”,”sort_two”,”sort_three”,”sort_four”,”sort_five”]; var correctOrder = [“sort_one”,”sort_two”,”sort_three”,”sort_four”,”sort_five”]; function arraysEqual(arr1, arr2) { if(arr1.length !== arr2.length) return false; for(var i = arr1.length; i–;) { if(arr1[i] !== arr2[i]) return false; } return true; } if(arraysEqual(correctOrder, userOrder) == true){console.log(“array match with position”)}else{console.log(“not match”)}

Published
Categorized as JavaScript

Remove duplicate array based on api response attribute value

Remove duplicate array based on api response attribute value is something different than a normal array. In this post we will find out how we can achieve by comparing attribute value of object array and remove the duplicate array. Remove duplicate array simple In the below code what we are doing is, we loop through… Continue reading Remove duplicate array based on api response attribute value

Published
Categorized as JavaScript