php - Checking validation against textboxes with jquery -


i have text boxes,their value being generated source.hence upon editing them if remove values , click submit button jquery validation doesnt work using jquery.

$(function() {$("#error1").hide();});  $('#save').click(function() {                 $('input:text').each(function(){        if( $(this).val().length == 0)           $("#error1").show('slow');        }); }); 

through jquery want validate textboxes.even required field validator not working.this may old question,but tried find solution,but didnt got valid answer it.please help.

try this,

$(function() {     $("#error1").hide();     $('#save').click(function() { // write in document.ready function         var flag=false;         $('input:text').each(function(){            if( $(this).val().length == 0) {               flag=true;               return false; //break loop if showing common message            }         });         if(flag === true) {// show error once              $("#error1").show('slow');         }     }); }); 

Comments

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -