locked
call function RRS feed

  • Question

  • User1728532267 posted

    Hi,

    I am student, created a web form, have 10 check box

    and a button

    I want use call function as we use in VB.net

    when i click button

    all check box visible should be false

    like this 

    -----------------------------

    function unvisible

    chk1.visible = flase

    chk2.visible = false

    chk3.visible = false

                                    so on.....

    -------------------------

    under button click event

    just i ll type 

    call unvisible

    any one help me?

    Thursday, April 2, 2020 11:12 AM

All replies

  • User475983607 posted

    Is there anyway you can share your code, explain the expected results, and actual results? 

    Keep in mind, the server control is NOT rendered (to the browser) when visibility is set to false.  Therefore you cannot use JavaScript to access the checkboxes.  Set the CSS dispaly:none property to toggle UI visibility and still have access to the checkbox.

    https://www.w3schools.com/css/css_display_visibility.asp

    Thursday, April 2, 2020 11:57 AM
  • User-719153870 posted

    Hi indicenzo,

    As @mgebhard mentioned, you can set the textbox's dispaly to none to hide it.

    Check below demo:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script>
            function HideTextBox() {
    //Both of below can work //document.getElementById("TextBox1").style.visibility = "hidden"; document.getElementById("TextBox1").style.display = "none"; } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="HideTextBox(); return false;" /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </div> </form> </body> </html>

    Best Regard,

    Yang Shen

    Friday, April 3, 2020 2:30 AM
  • User-1151440187 posted

    You can use prop function of js.

    $(document).ready(function(){

    $("#button-id").click(function(){

    $("#chk-id").prop("checked" , false);

    }):

    });

    Tuesday, April 21, 2020 5:32 AM