I want to make an empty div react to click.
HTML
<div id="closeButton"></div>
CSS
#closeButton {
height:100px;
position:absolute;
righ开发者_JAVA技巧t:0;
top:0;
width:100px;    
z-index:1000;
border:1px solid blue;
}
Javascript
$('#closeButton').click(function() {
alert("yo");
});
This works perfectly in Firefox, but not in Internet Explorer. Why?
I solved it by adding a 1x1 transparent png as background-image. This made the div render properly and possible to use for click functions.
It seems to be a wierd bug, and the only solution is to set IE in HTML4 standards-compliant mode
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Try this:
$(function(){
  $('#closeButton').click(function(){
      alert("yo");
  });
})
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论