I am writing a bookmarklet in which I want to use the jquery forms plugin.
The problem I am having is that a web page on which the bookmarklet might be used could be using a different js lib, which already uses ‘$’. No problem, I can tell jQuery to use noConflict()
However, the forms plugin of jQuery also uses ‘$’ which I have no control over. Is there a way for me to specify to this plugin to not use $ and use jQuery instead?
More details..
As TNi suggests, I might be misunderstanding the problem.
Here is what I do
I am using Safari 5. Here is what I do
(jquery 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 the javascript console:
jQuery("#a2b_cart").ajaxForm is not a function
Chances are, your code initializing the form is called immediately after adding the
scriptelement, but before it has loaded. Since jQuery is already loaded, call the forms file viagetScript:The callback function will only be run once the script file has loaded.