IE everlasting problem with selectors

2019-08-16 17:32发布

问题:

I think that i have some problems with jquery selectors in IE. Chrome and Firefox is ok, but not IE. Not only selector from example below not works. Every selectors not works in IE. I am using jquery 1.6.2 and jquery-ui.min 1.8
Example:
html:

<p id="clickme">clik me</p> 

jquery:

$(function(){
       $('#clickme').click(function(){alert('hello')})
})

回答1:

Ok, I have had tons of problems with syntax on IE. Get in the habit of using semi colons. I looked at your JavaScript file and there was quite a few that seem to be non existent.

$('#clickme').click(function(){
    alert('hello');
});


回答2:

you should insert your code in document ready function of your js first.you should insert simicolon at the end of click function too.

for better help ,please insert your code completly here.