开发者

js method in Application.js not being called

I put the following method in my application.js file.

va开发者_如何学Gor formhandler = function() {
    var submit, isSubmit = false;
    submit = function(){
                // flop and return false once by the use of operator order.
    return isSubmit != (isSubmit = true);
    };
    return {
       submit: submit
       };
}(); // <-- use direct invcation to keep the internal variables "static"

It works fine if I write it directly in the header section of the form. However when I put it in the application.js file it is not being called or found.

How should I call functions that are in applcation.js.

Also I have the following in the header of the layout.

<%= javascript_include_tag :all, :cache => true, :recursive => true %>`enter code here`


I don`t fully understand your question,so I may be wrong, but as a remark:

here you always return false:

return isSubmit != (isSubmit = true);

I think it should be

return isSubmit != (isSubmit == true);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜