hey guys. im trying to show a dropdown list and hide input text when an option in another drop down list is selected.
dropdown
<select name="table-type" id="select-t">
<option value="" disabled selected>Types of Tables</option>
<option value="Round Table" id="rt">Round Table</option>
<option value="Banquet Table" id="bt">Banquet Table</option>
<option value="Square Table" id="st">Square Table</option>
</select><br>
No. of seats : <br>
<input type="text" readonly placeholder="Select Table" size="8" id="inform" />
<select name="seatno" class="seat-r" id="seat-r">
<option value="" selected disabled>No. of seats</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
</select>
<select name="seatno" class="seat-b" id="seat-b">
<option value="" disabled selected>No. of seats</option>
<option value="6">6</option>
<option value="8"></option>
<option value="10"></option>
</select>
<select name="seatno" class="seat-s" id="seat-s">
<option value="" disabled selected></option>
<option value="6">6</option>
<option value="8">8</option>
</select>
jquery
<script type="text/javascript>">
$("#select-t").change(function() {
if ($(this).find("option:selected").attr("id") == "rt")
{
$("#seat-r").show();
$("#inform").hide();
}
if ($(this).find("option:selected").attr("id") == "bt")
{
$("#seat-b").show();
$("#inform").hide();
}
if ($(this).find("option:selected").attr("id") == "st")
{
$("#seat-s").show();
$("#inform").hide();
});
</script>
but the script doesn't seem to be working. nothing happens when an option from select-t
is selected. the dropdown lists are hidden in css visibility:hidden
. is it because of that?
thanks in advance