I\'m working on a library which uses jQuery internally which work fine. But I don\'t want force the user to use my jQuery version just because he uses my library in his code
You'd have to go into the source because window.jQuery is defined there, and just update the reference name.
This seems like an unreasonable request though.
Edit: Looks like all you have to do is set the reference to $.noConflict:
<script src="jquery.js"></script>
<script>
var foo = {};
foo.jQuery = jQuery.noConflict( true );
alert( typeof jQuery );
alert( typeof $ );
alert( typeof foo.jQuery );
</script>
You'd have to do this right after you include the script though. My previous way did it directly in the script:
http://173.45.226.115/jquery.html
By specifying true in the jQuery.noConflict(true);
, it sets the noConflict to extreme mode and should make it so it won't conflict with any other library. It should be the first thing you define anywhere I'm guessing, so no jQuery code/plugin should appear before the var mylib.jQuery = jQuery.noConflict(true);