<script type="text/javascript">
    $(document).ready(function () {
        var e = document.getElementById("ddlCategory");
        var value = e.options[e.selectedIndex].text;
        if(value == "Others") {
            $('#Other').show();
        } else {
            $('#Other').hide();
        }
    });
</script>

        <table>
            <tr>                   
                <td><asp:Label runat="server" Text="Category: " /></td>
                <td><asp:DropDownList ID="ddlCategory" runat="server" ClientIDMode="Static" /></td>
            </tr>
            <tr id="Other" style="display:none">
                <td><asp:Label runat="server" Text="Others: " /></td>
                <td><asp:TextBox ID="txtOthers" runat="server" /></td>
            </tr>

i tried already, and it doesn't work.
Thanks for the advanced.

Recommended Answers

All 2 Replies

Please clarify what your objective is...

Sorry about that,
The dropdownlist ddlCategory when Page_Load will insert insert data through code behind, Others is one of the item.
Once the user selected Others will automatically show this <tr id="Other">

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.