HI
My name is frank, I need help with a code that doesn’t work as I expect and I don’t understand why. my code is on codepen:
https://codepen.io/cfrank2000/pen/LoBvPd
https://codepen.io/cfrank2000/pen/LoBvPd
the faulty part is:
(".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 ) {
// }
});
please help me, thank you.
The code pen mixes HTML and Javascript and is very difficult to read/understand. On first glance this has not much to do with Meteor and the coding patterns it deploys. Meteor offers it’s own event handling, dependent on which front-end has been chosen. Your code seems pure HTML/DOM/jQuery
Hi
thank you for answer. yes, I am using jquery in a html document to validate input fields but I screwed up. the first part loks working by typing data (blur() function). the second part (submition: click function) , to check if field are empty before submition, partialy works, partialy don’t. if all fields are empty, I get the right message, if I type something only, anywere, checking happens untill the first filled up field, then looks checking stops. the first thing is event.preventDefault() I might need to fix, then condition might need adjustment too. please help me, thank you.
ps : testing mater was suggested me to do a general fault check but I never done it, loking up on the net I realised ther are more ways to do it and I feel myself confused, I don’t understand it no clue how to start it.
thank you, please help me, frank