Example
$("#top_notice").css("display", "block");//The first method
//$("#top_notice").attr("style", "display:block;");//The second method
//$("#top_notice").show();//The third method
1. Change the class of the element to hide the div. The premise is that the changed class style defines the hidden attribute
$("#sendPhoneNum").attr("class", "n_input3");
1.2 Set the style attribute to the element
$("#top_notice").attr("style", "display:block;");
2. Use jquery’s css method to set the div to hide
$("#sendPhoneNum").css("display", "none");
3. Use jquery’s show() and hide() methods to set the div to hide
$("#textDiv").show();//Show div
$("#imgDiv").hide();//Hide div
The display and hiding of divs are often used in programming. Here are several methods:
1. $("#demo").attr("style","display:none;");//Hide div
$("#demo").attr("style","display:block;");//Display div
2. $("#demo").css("display","none");//Hide div
$("#demo").css("display","block");//Display div
3. $("#demo").hide();//Hide div
$("#demo").show();//Show div
4. $("#demo").toggle(
function () {
$(this).attr("style","display:none;");//Hide div
},
function () {
$(this).attr("style","display:block;");//Display div
}
);
For your reference only!