Bonky Zhu
If someone is able to show me that what I think or do is not right, I will happily change, for I seek the truth, by which no one was ever truly harmed. It is the person who continues in his self-deception and ignorance who is harmed.

jQuery放到head中失效的原因与解决方法

代码如下

屏幕快照 2019-10-06 下午9.57.23

因为文档还没加载,就读了jsjs就不起作用了想在head里用的话,用

屏幕快照 2019-10-06 下午9.57.23

意思是等文档已经加载完成了之后再执行 js 代码

或者把代码放在body里面也可

修改后的代码如下

屏幕快照 2019-10-06 下午9.57.23

Share

You may also like...

发表评论