JQuery forms plugin noConflict problem

I am writing a bookmarklet in which I want to use the jquery forms plugin.

The problem I ran into is that the webpage on which the bookmarklet can be used can use another js lib that already uses "$". No problem, I can tell jQuery to use noConflict ()

However, the jQuery forms plugin also uses "$", which I have no control over. Is there a way to tell me this plugin not to use $ and use jQuery instead?

Read more ..

As TNi suggests, I might not understand the problem.

That's what I'm doing

I am using Safari 5. Here is what I am doing (jquery is already loaded) ....

var scriptElem = docEl.createElement('script');
scriptElem.setAttribute('src',"http://localhost:81/p/a2b/jquery.form.js");
scriptElem.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);

and then

jQuery(docEl).ready(function() {
    jQuery('#a2b_cart').ajaxForm(function () { alert (" yo");});

});

What I see on javascript console:

jQuery("#a2b_cart").ajaxForm is not a function
+3
2

, , , script, . jQuery , getScript:

jQuery.getScript("http://localhost:81/p/a2b/jquery.form.js", function () {
    jQuery('#a2b_cart').ajaxForm(function () { alert("yo"); });

    // Rest of your code here, or call out to another function
});

// Don't place code here, form.js hasn't loaded yet.

script.

+2

Form Plugin , $ , jQuery.noConflict().

, jQuery $. , , .

+2

Source: https://habr.com/ru/post/1754148/


All Articles