I currently have an input form. There are two entries for each input class:
<form>
<input type="text" name="firstname_a" class="firstname" disabled="disabled" />
<input type="text" name="firstname_b" class="firstname" />
<input type="text" name="surname_a" class="surname" disabled="disabled" />
<input type="text" name="surname_b" class="surname" />
<input type="submit" value="submit" />
</form>
When submitting, I want JQuery to check if a match value of b was assigned (the value of a was entered by the end user, the value of b was entered by a homeworker working in a verification company). A form can have up to 470 input fields; they are stored in a database depending on the type of checks performed. Therefore, I do not want to enter 470 times !:
if($('input["name=firstname_a"]').val() == $('input["name=firstname_a"]').val())
{
// do something
}
else
{
// do something else
}
Rather, I would like to find a dynamic way to do this, perhaps using the serializeArray () function, but I'm afraid! Any or all help would be greatly appreciated.
source
share