I’ve been trying to write Jquery code to check if two inputs have the same value on form submit without luck.
If input with id “id1” has the same value as input with id “id2” alert “some text” and return false.
Any help would be much appreciated.
$('#form').submit(function() {
var id1 = $(#id1).text();
var id2 = $(#id2).text();
if (id1 == id2) {
alert('Error, cant do that');
return false;
}
else
{
return true;
}
});
DEMO HERE
I simply used blur rather than a form submit.