Home > Web Front-end > HTML Tutorial > The jquery statement written in the page is executed normally, but it cannot be executed when placed in the JS file_html/css_WEB-ITnose

The jquery statement written in the page is executed normally, but it cannot be executed when placed in the JS file_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:52:15
Original
1473 people have browsed it

RT,
The page is

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

. Remove the script tag and put it into the JS file intact, then import it.


cannot be called.

Reply to discussion (solution)

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

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

If it cannot be executed, please show the error reported by the browser first. I think it may be jquery and you. The js files are introduced in the wrong order

Brother, how can you run it if you don’t plan on it?
$(document).ready(function(){
//Put the function you want to run here
});

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template