I have 2 forms
<form name= "form1" action="">
<input type="hidden" name="max" id= "max1" value="100"/>
<input type="submit" class="submit" value="part 1" />
</form>
<form name= "form2" action="">
<input type="hidden" name="max2" id= "max2" value="200"/>
<input type="submit" class="submit" value="part 2" />
</form>
I get the values from this form here
$(".submit").click(function () {
here --> var max_res = $("input#max1").val();
var Results = "Max Result " + max_res;
});
My question is how can i dynamically change the id from max1 to max2 so I can store max2‘s value in max-res when a click is made in form2
1 Answer