You can use the hidden,visible selector: The hidden selector: // Matches all elements that are hidden $(‘#myDiv’).is(‘:hidden’) The visible selector: // Matches all elements that…
Leave a CommentCategory: Javascript / JQuery Snippets
var capitalizeMe = “capitalize the first letter of a string in javascript”; var capitalized = capitalizeMe[0].toUpperCase() + capitalizeMe.substring(1); console.log(capitalized); // Capitalize the first letter of…
Leave a Comment$(“.myCheckbox”).attr(‘checked’, true); // Deprecated $(“.myCheckbox”).prop(‘checked’, true); Check if the checkbox is checked There are several ways to get to work out if a checkbox is…
Leave a Commentvar url = ‘http://www.arjunphp.com/’; $(location).attr(‘href’,url);
Leave a CommentHere is the simple JQuery script snippet for detecting current mouse coordinates using JQuery function. $(document).mousemove(function(e){ console.log(“X = ” + e.pageX + ” and Y…
Leave a CommentHere is the code snippet for validating email using JavaScript function IsEmail(email) { var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; return regex.test(email); }
Leave a Comment