There are many ways to show and hide an element. You can find a way on Baidu. Here I will record how I show and hide it for future review.
The requirement is: when the state is 1 and 2, the button (id is plshbtn) is hidden; when the state is 0, the button will be displayed.
js method is as follows:
if($("#state").val()==0){ $("#plshbtn").attr("style","display:block;"); } if($("#state").val()==1||$("#state").val()==2){ $("#plshbtn").attr("style","display:none;"); }
For more related tutorials, please visit JavaScript video tutorial