1、$("#demo").attr("style","display:none;");//隐藏div $("#demo").attr("style","display:block;");//显示div 2、$("#demo").css("display","none");//隐藏div $("#demo").css("display","block");//显示div 3、$("#demo").hide();//隐藏div $("#demo").show();//显示div 4、$("#demo").toggle( function () { $(this).attr("style","display:none;");//隐藏div }, function () { $(this).attr("style","display:block;");//显示div } );
<div id="demo"></div>