Given a user-defined variable jstatus, I want that that particular variable should be selected in a given list of options.
My list is like this:
<select name='job_status' id='job_status'>
<option>Pre-press</option>
<option>Printers</option>
<option>Cutting</option>
<option>Final touches</option>
<option>Delivery</option>
<option>Ready</option>
</select>
And somewhere in my javascript code after setting the value of jstatus, this is my jquery:
$("#job_status option[value='"+jstatus+"']").attr('selected','selected');
But it's not working. What's the right way to do it?
valueattribute to each<option>tag