Here is my HTML Code.
<table>
<tr>
<td>
<select class="dropdown">
<option value="">Select answer</option>
<option value="1" selected="selected">A</option>
<option value="2">B</option>
<option value="3">C</option>
</select>
</td>
<td>
<select class="dropdown">
<option value="">Select answer</option>
<option value="1" >Yes</option>
<option value="2">No</option>
<option value="3">N.A.</option>
</select>
</td>
</tr>
<td>
<select class="dropdown">
<option value="">Select answer</option>
<option value="1" >Yes</option>
<option value="2">No</option>
<option value="3">N.A.</option>
</select>
</td>
</table>
Here is my jquery code.
$('TABLE TR').find('select:first').each(function()
{
if($(this).find("option:selected").text()=="A")
{
$(this).next("select").find("option[value='Yes']").remove();
}
});
I want to remove the immediate next drop down value based on the value of first dropdown box. Please someone help..
Try this jQuery:
This code will delete “Yes” option from the second dropdown. It seems that it is exactly what you want.