In my ASP.net project, I am using a jquery script to update the id=person field in the URL bar:
$("form").append("<input type='hidden' name='hiddenEmployeeId' value='" + $('#EmployeeSelected').val() + "' />");
This is triggered when the value of the drop-down box changes. It works great, except for the fact that when you change it…it just appends the new id behind the first id, which is exactly what it’s supposed to be doing.
However, I only want one id, obviously. What can I do here to accomplish this? Is there a way to CLEAR that first, and then append it?
Thanks!
Check to see if it exists, if so, set the value. If it doesn’t append it: