I am updating the selected option programmatically using jQuery
Not as much as I can see. You reset the value of the selected option , but do nothing, as far as I can tell the actual select field.
To change a select , you need to identify it, then call val on it , not one of its option elements.
I canβt understand what you need to do input[name="button1"] , but here is an example of updating the select field: Live copy | a source
HTML:
<select id="theSelect"> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select> <input type="button" id="theButton" value="Click me">
JavaScript:
jQuery(function($) { $("#theButton").click(function() { $("#theSelect").val("2"); }); });
Separately, as pointed out in the comments of j08691, you cannot assign the same id value ( "assigner" ) to more than one element. id values must be unique in the document. Your code does not show that you are using this id , so this may be unrelated, but worth noting.
source share