I'm having the select field as below.
<select id="mySelect1">
<option value="-1">select</option>
<option value="1">Node-Red</option>
<option value="2">Node</option>
<option value="2">Node-JS</option>
</select>
Note: I have the same value for two options.
When I tried below link suggestion it always set the final matching value.
jQuery: Setting select list 'selected' based on text, failing strangely
example: if I tried to set the value for the drop down as "Node" using the below code, it always selects Node-JS in the drop-down.
$("#mySelect1 option:contains("Node")").attr("selected", true);
So is it possible to set the drop down values using the text(not with matching value ) with the same value for many options ?
Any Suggestions ?