I'm having some problems validation my form. What I want to do is to check if some input field are equals, and stop the form input if true. Something like this:
<form id="myForm">
<input type="text" id="id1" />
<input type="text" id="id2" />
<input type="text" id="id3" />
<br/>
<input type="text" id="id4" />
<input type="text" id="id5" />
<input type="text" id="id6" />
...some other inputs (id7, id8, id9 - id10, id11, id12 - ...)
<p id="error" hidden="hidden">
Error
</p>
<input id="submit" type="submit" value="submit" />
</form>
If id1, id2 and id3 have the same value (in the same order) of id4, id5 id6 must stop the form input. Id1, id2 and id3 can have the same value, and Id4 can have the same value of id1, and so one, but the three together (id1, id2, id3) can't have the same values of id4, id5, id6. For example an error is:
- id1: One
- id2: Two
- id3: Three
- id4: One
- id5: Two
- id6: Three
All the other cases are fine.
I'm trying something like this: http://jsfiddle.net/g2kBm/283/ but it's not working.
Your if statement should be something like the following:
http://jsfiddle.net/g2kBm/284/
You don't need the on blur event, as you're checking on submit. Also, you need to check if #1 == #4 AND #2 == #5 AND #3 == #6: