Latest news
Home » jQuery (page 4)

jQuery

jQuery Validation of login by pressing enter key

Validate login by pressing enter key $(“#username, #password”).keydown(function(event) { // track enter key var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode)); if  ( keycode  == 13) {   // key code for enter key // force the keyboard  ‘Enter Key’ to implicitly click the Update button validateLogin(); return false; } else  { return true; } }); ...

Read More »

How to write a jQuery function

jQuery function jQuery is a type of  JavaScript programming script used in website development. jQuery is very strict in its syntax .Programmers are writing jQuery functions for doing specific tasks. Syntax of JQuery  function is //start <script type=”text/javascript”> $(“#username”).keydown(function(event) { }); </script> //end function This is a keydown function

Read More »

How to loop through array in jquery

if(jQuery.trim(jQuery(“#custom-email-input”).val()) != ”) { var sCustomemails = jQuery(“#custom-email-input”).val().split(‘,’); jQuery.each(sCustomemails, function(index, email) { if(!validEmail(email)) { jQuery(“#custom-email-input”).addClass(‘error’); alert(‘Please enter only valid email addresses.’); jQuery(“#custom-email-input”).attr(‘placeholder’,’Please enter only valid email addresses’); error=true; } else { jQuery(“#id_subject”).removeClass(‘error’); } }); }

Read More »