I am looking for a way to change the option value from a select tag when users click on a link.
For example I have a select option html:
<select> <option value="0">Please Select</option>
<option value="1">red</option>
<option value="2">white</option>
</select>
And I have 2 links <a href="#" title="red" class="preview_link">red</a> <a href="#" title="white">white</a>
When user clicks red the option will switch to red and white will switch to white. I am using the following code but it is not working.
jQuery("a.preview_link").click(function() {
var title = jQuery(this).attr("title");
jQuery(this).parent('p').children("select :selected").text(title);
});
Any suggestions?