Jquery judges display as an element of none

1, $("- sharpaddinfo"). Hide (); addinfo hide () or show () ;
2,

if (($("-sharpaddinfo").css("display")) === "none") {
  alert("");
  $(el).css({
    "width":360,
    "position":"fixed",
    "left":"50%",
    "top":"50%",
    "z-index":9999
  }).css({
    "margin-left":-parseFloat($(el).outerWidth())/2,
    "margin-top":-parseFloat($(el).outerHeight())/2,
    "display":"none"
    });
} else {
  $(el).css({
    "width":780,
    "position":"fixed",
    "left":"50%",
    "top":"60%",
    "z-index":9999
  }).css({
    "margin-left":-parseFloat($(el).outerWidth())/2,
    "margin-top":-parseFloat($(el).outerHeight())/2,
    "display":"none"
  });          
}


3 

      $(document).on("click","-sharpordinaryuser",function () {
           /* $("-sharpaddinfo").hide();*/
            $("-sharpaddinfo").css({"display":"none"});
            $("-sharpisstudent").val(0);
            $("-sharpordinaryuser").hide();
            $("-sharpstudentuser").show();
    
        });

4, if (($("- sharpaddinfo"). Css ("display")) =" none") this has no effect, solve?

Feb.19,2022

$('- sharpaddinfo'). Css ('display') =' none'
the above code can tell whether the element is hidden enough


// jqueryis
if ($("-sharpaddinfo").is(':visible'))

1. For the explicit and implicit switching of objects, you can use $('.selector'). Toggle () , reference document ;
2). In addition, your style is redundant, so you can only set the width.
3. Learn about $.fn.is (': visible') or $.fn.get (0). Style.display = 'none' ;

  

objects are shown and hidden. Generally, toggleClass ('class') is used directly. It is relatively troublesome to judge whether display is none,.

Menu