Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HTML
<option value="stuffhere">Otherstuff</option>


JavaScript
$('#BAMDEXSEARCH1').click(function() {
if variable == "string"
//want to change the value and option of a select here 
}
Posted
Comments
Sergey Alexandrovich Kryukov 11-Feb-15 10:53am    
Sorry, not clear at all. Could you formulate it properly, for example, show an example of select, "before" and "after", on what event/condition, etc. Even better, just do it yourself, by learning how JavaScript works on DOM elements. (What have you tried so far?) Of course you can manipulate any HTML element, without any limitations.
—SA

1 solution

To change the selected item of a dropdown in jQuery you can do:

JavaScript
$('#BAMDEXSEARCH1').val("whatEverValueFromListYouWant");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900