开发者

about jQuery fn declaration

开发者 https://www.devze.com 2023-03-29 11:16 出处:网络
my two js files (file1.js & file2.js) works but when i made some changes in file2.js then it doesn\'t work, why?.

my two js files (file1.js & file2.js) works but when i made some changes in file2.js then it doesn't work, why?.

/* file1.js */
$(function() {
    $(".some").click开发者_开发问答(function() {
        ...
    });
});

/* file2.js */

window.onload = test();
function test() {
    $(".dragfile").draggable(function() {
        ...
    });
    $(".resize").resizable(function() {
       ....
    });
}

Now i make changes in file2.js and some functions are not working. file1.js remains same

/* file2.js */
// window.onload = test(); function test() {  }

$(function() { // modified              
    $(".dragfile").draggable(function() {    // this function works
        ...
    });

    $(".resize").resizable(function() {      // this isn't working
        ...
    });
});


I do not see any declaration error although i'd say to go through your files again, clean server directory & publish project again.

It seems your file is not updated when you make any changes.


Check the jQuery documentation on .ready() (which you are using the $(handler) form of)

The .ready() method is generally incompatible with the <body onload=""> attribute. If load must be used, either do not use .ready() or use jQuery's .load() method to attach load event handlers to the window or to more specific items, like images.

And unless you are using a jQuery plugin that provides .resizeable(), like mentioned by others, you probably meant .resize()

0

精彩评论

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