Own defined attribute for input

Darrious

New Member
I have a HTML File, that looks like this:\[code\] Input 1: <input type="text" required="false" /><br> Input 2: <input type="text" required="true" /> *<br> Input 3: <input type="text" required="false" /><br> Input 4: <input type="text" required="false" /><br> Input 5: <input type="text" required="true" /> *<br> Input 6: <input type="text" required="false" /><br> Input 7: <input type="text" required="true" /> *<br> <input type="button" id="subButton" value="http://stackoverflow.com/questions/14602940/Run" />\[/code\]This is my jQuery-script:\[code\]$(document).ready(function(){ $("#subButton").click(function(){ //Copy START var setError = false; $.each($(":input"), function(e){ if(($(this).attr("required") == "true") && (this.value =http://stackoverflow.com/questions/14602940/="")){ setError = true; } }); if(setError != false) alert("Not all required fields are filled"); //Copy END }); });\[/code\]If i change the attr to "type", it works if i not fill up every box. But i want to use this with the attribute required.Any ideas, why it doesn't work?Thanks for help
 
Back
Top