I am trying to avoid having the same code for different ids. Something like submitter1, submitter2, etc. In the same process, having the variable also used to get the input box id of differentlocation1, differentlocation2, etc. Can someone help me out with the code below?
$(document).ready(function() {
$('#submitter<--Variable Here-->').click(function(event) {
event.preventDefault();
var newlocation = $("input[name=differentlocation"<--Same Variable Here-->"']");
alert(newlocation); //testing purposes
//$('#location').val(newlocation).change(); //Changes location input box
//$("#submit").click(); //submits new location
});
});
This code works using static ids, but like I said I would like to adjust it to use variable ids as well.
Thanks.