I have a form where inputs are dynamically generated two input fields with the same id, same name and same value.
User can then change any value in one of these two similar inputs (ie for example firstname). How can i check if the values in the two input fields are the same, if they are same then just submit the first input and if not the same then submit the changed value.
so final submit will have only firstname:test and lastname:testtwo
how ever if a value is changed for firstname to david than final submit will be firstname:david and lastname:testtwo
<form id="myform" name="myform">
<input type="text" name="firstname" id="firstname" value="test" />
<input type="text" name="firstname" id="firstname" value="test"/>
<input type="text" name="lastname" id="lastname" value="testtwo" />
</form>
idhas to be unique, W3C documentation