locked
How to hide row in table RRS feed

  • Question

  • User491718545 posted

    hi

    <tr id="tempTR">
    <td><span class="required">*</span> State:</td>
    <td><input type="text" name="lastname" id="txt_State" runat="server" value=""/>
    </td>

    $(document).ready(function ($) {

    $('#tempTR').hide();--here hiding table row

    }

    how to unhide that row

    function handleClick1(obj) {
    $('#tempTR').style.display = 'block';--this coding doesnot work for me
    }

    give me solution visible that row

    thanks

    Thursday, December 19, 2013 2:08 AM

Answers

  • User-1509636757 posted

    You can use .show() method of element in jQuery. Check out below sample code snippet:

    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script src="http://codeorigin.jquery.com/jquery-2.0.3.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $('#tempTR').hide();
    
                $("#<%=btnClick.ClientID %>").click(function () {
                    $('#tempTR').show();
                    return false;
                });
            });
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <table>
                <tr id="tempTR">
                    <td><span class="required">*</span> State:</td>
                    <td>
                        <input type="text" name="lastname" id="txt_State" runat="server" value="" />
                    </td>
                    </tr>
            </table>
            <asp:Button ID="btnClick" Text="Click me" runat="server" />
        </form>
    </body>
    </html>

    hope it helps./.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 19, 2013 2:15 AM

All replies

  • User-1509636757 posted

    You can use .show() method of element in jQuery. Check out below sample code snippet:

    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script src="http://codeorigin.jquery.com/jquery-2.0.3.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $('#tempTR').hide();
    
                $("#<%=btnClick.ClientID %>").click(function () {
                    $('#tempTR').show();
                    return false;
                });
            });
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <table>
                <tr id="tempTR">
                    <td><span class="required">*</span> State:</td>
                    <td>
                        <input type="text" name="lastname" id="txt_State" runat="server" value="" />
                    </td>
                    </tr>
            </table>
            <asp:Button ID="btnClick" Text="Click me" runat="server" />
        </form>
    </body>
    </html>

    hope it helps./.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 19, 2013 2:15 AM
  • User177399542 posted

    Try this:

    <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#tempTR").css("display", "none");
            });
    
            function handleClick1(obj) {
                $("#tempTR").css("display", "block");
            }
    
        </script>
    <table>
                    <tr id="tempTR">
                        <td><span class="required">*</span> State:</td>
                        <td>
                            <input type="text" name="lastname" id="txt_State" runat="server" value="" />
                        </td>
                    </tr>
                    <tr>
                        <td><a href="#" onclick="handleClick1()">Show</a></td>
                    </tr>
                </table>



    Thursday, December 19, 2013 2:26 AM