Hi my name is frank(ferenc in hungarian), I have quite a big headache, checking form fields with functions click, each, works untill fields are empty, if I just complete filling partially it doesn't work. at the first ok, the checking stops. please help me, thank you, frank the faulty code: $(".button1").click(function(){ var emptyfield = true; $(".input-check").each(function(){ //$("span").text(inpattr) var inputattr = $(this).attr("id"); if ( $(this).val()==="") { inputmsg(this, inputattr); //$(this).next(".fielderror").html(inpattr+" is EMPTY: Please enter data into this input"); //$(this).next(".fielderror").addClass('warning').removeClass('ok'); //$("form").submit(function(e){ }); //alert('submit intercepted'); //emptyfield = false; $('.button').submit(function(event){}); event.preventDefault(); } else { //inputmsg(this); $(this).next('span').text(inpattr + " " + " is Ok"); } //alert(inpattr); }); // if ( emptyfield === false ) { // } }); Code (javascript):
Hi what I experienced is at the first not empty field the each function did not continue the empty check but stopped, leaving the fields as they were, I don't understand, also I have problem using event,preventDefault. please help me, thank you, frank
Why are you using JavaScript -- much less the bloated train wreck of ineptiude that is jQuery -- to do the HTML 5 "required" attribute and/or server side processing's job?
I've learned a bit of jquery and I thought it can be useful for validation. I didn't believe it will be so complicated and confusing. can I get help to find out what was the mistake I made? thank you, frank