开发者

javascript strange behaviour of jQuery .click

开发者 https://www.devze.com 2023-02-01 20:25 出处:网络
I ahve a html file, in which I inclu开发者_运维技巧de .js file. This file contains this code: $(document).ready(function(){

I ahve a html file, in which I inclu开发者_运维技巧de .js file. This file contains this code:

$(document).ready(function(){
    $("button.save").click(function(){
        alert("payment_type_form_");
    });
    PlanTabs.Open("payments");
    $("#payment-types-accordion").lyfAccordion();
});

All good works. But .click() doesn't. If I move this code to html <script></script> all good nice.

I want to keep javascript code in file, not in html. How can I do it?

Thank you in advance. Sorry for my english)


Are you sure jQuery is included before this script file? That's where I've encountered these problems.


try putting your script near the bottom of the </body> tag

0

精彩评论

暂无评论...
验证码 换一张
取 消