IE everlasting problem with selectors

寵の児 提交于 2019-12-24 20:19:18

问题


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.



来源:https://stackoverflow.com/questions/6975631/ie-everlasting-problem-with-selectors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!