Home  >  Article  >  Web Front-end  >  jquery语句写在页面中正常执行,放到JS文件里面就执行不了_html/css_WEB-ITnose

jquery语句写在页面中正常执行,放到JS文件里面就执行不了_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:52:151414browse

RT,
页面中是

<script>$("form#login").submit(function(){		***********});</script>

去掉script标签以后原封不动放到JS文件里面,然后引入,无法调用


回复讨论(解决方案)

$(function(){
$("form#login").submit(function(){
        ***********
});
})

$(function(){$("form#login").submit(function(){        Your code here!});});

执行不了,先把浏览器报的错给图出来,我想可能是jquery和你的js文件引入的先后顺序不对

大哥,你不准备怎么运行。
$(document).ready(function(){
//这里放你要运行的函数
});

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn