how to hide a panel in javascript

后端 未结 2 1133
滥情空心
滥情空心 2021-01-24 06:11

What is the best approach to show and hide an asp panel which is containing other controls like textbox and label controls

相关标签:
2条回答
  • 2021-01-24 06:29

    Can you try

    document.getElementById( 'Panel1ClientId' ).style.display = 'none'; // to hide
    

    and

    document.getElementById( 'Panel1ClientId' ).style.display = 'block'; // to show
    

    ?

    0 讨论(0)
  • 2021-01-24 06:34

    Using jQuery, you can just switch visibilty:

    $('#<%= YourPanel.ClientID %>').hide();
    $('#<%= YourPanel.ClientID %>').show();
    

    Edit: jQuery is probably overkill just to hide/show, but if you plan to add more functionality client side, you should consider using it ;)

    0 讨论(0)
提交回复
热议问题