Show hide div using codebehind

前端 未结 8 2067
难免孤独
难免孤独 2020-12-30 00:29

I have a DropDownList for which I am trying to show a div OnSelectedIndexChanged but it says OBJECT REQUIRED.

I a

8条回答
  •  孤独总比滥情好
    2020-12-30 01:17

    Hiding on the Client Side with javascript

    Using plain old javascript, you can easily hide the same element in this manner:

    var myDivElem = document.getElementById("myDiv");
    myDivElem.style.display = "none";
    

    Then to show again:

    myDivElem.style.display = "";
    

    jQuery makes hiding elements a little simpler if you prefer to use jQuery:

    var myDiv = $("#<%=myDiv.ClientID%>");
    myDiv.hide();
    

    ... and to show:

    myDiv.show();
    

提交回复
热议问题