I have a HTML script like this:
<form id="no1">
<input id="title" type="text" />
<input type="submit" />
</div>
<form id="no2">
<input id="title" type="text" />
<input type="submit" />
</div>
I then have a validation script using jQuery. However I would like it to validate the form which has been submitted.
At the moment when I click sumit the jQuery validates the wrong input (because they both have the same id name).
I tried this code, but it didn’t work (the “this” is the form element):
var title = $(this).("input#title").val();
Try this