.click event with dropdownlist items
Hi,
I have the following asp.net code:
<asp:DropDownList runat="server" ID="dealerList" ClientIDMode="Static">
<asp:ListItem >Option 1</asp:ListItem>
<asp:ListItem >Option 2</asp:ListItem>
<asp:ListItem Value="other">Other(Note below)</asp:ListItem>
</asp:DropDownList>
<br />
<asp:TextBox runat="server" ID="dealer" Visible="True" ClientIDMode="Static"></asp:TextBox>
and the following jquery code:
<script type="text/javascript">
$(document).ready(function () {
$("#dealer").hide();
$("#dealerList option:eq(2)").click(function () {
$("#dealer").show();
});
$("#dealerList option:eq(0)").click(function () {
$("#dealer").hide();
});
$("#dealerList option:eq(1)").click(function () {
$("#dealer").hide();
});
});
</script>
the idea is to show the asp:text box only when the "Other(note below)" option is selected, and then to hide it if one of the other two options are selected. This works only in firefox. however in IE or Chrome it does not.
Is there any other technique that will work across all browsers?
Thanks in advance.