enavu webdevmania tutsvalley psdestination
visit the enavu network
10 Comments Article Title Overlay Article Title

Using multiple versions of jQuery on the same page

There are few reasons why you would want to disable the menu we get after clicking right mouse button. One of them is if you want to show your own menu. In this daily tip we will disable that default menu using jQuery.

  • DZone
  • Digg
  • Design Float
  • Delicious
  • Blinklist
  • Reddit
  • Facebook
  • Google Buzz
  • Twitter
  • StumbleUpon
  • Tumblr
  • Share/Bookmark
You might be wondering why would you want to use different version of jQuery on the same page, why not just use the newest version, right? Well in my freelancing career as a web developer i stumbled upon few websites that are using jQuery ver 1.2.x and when i changed it to 1.3.x some of the plugins stopped working, so i needed to have both versions on a same page. This is how it’s done…

<script type='text/javascript' src='js/jquery_1.3.js'></script>

<script type='text/javascript'>

 var $jq = jQuery.noConflict();

</script>

<script type='text/javascript' src='js/jquery_1.2.js'></script>

And this way when you want something made with the new version of jquery instead of the “$” use “$jq”.

Example:

$jq('.selector').live('click', function(){
    //do something
});

You can also use this trick if there is prototype on the site, because it’s also using the $.

Ok, that’s it for today, i hope this little tip helped you or will help you in future.

Related posts:

  1. Easy Unobstructive jQuery Print Page Tutorial
  2. Use HTML5 Placeholder Input Attribute Today using jQuery!
  3. Automatic input field focus on page load
  4. Top 10 jQuery Snippets (including jquery 1.4)
  5. Little app to help you code 10+ times faster

Slobodan Kustrimovic

This author has yet to fill his BIO.

Did you absolutely LOVE this article... share it!

Comments

  • Wow, you just saved me so much hassle this is without doubt one of the most useful code snippets I have come across.

  • Glad to be helpful :)

  • thanks, and compliments for all the articles

  • You can check here with demo example.

  • http://aspnetnova.blogspot.com/2009/12/jquery-multiple-version-of-jquery-in.html
    Demo here with source.

  • nice …i m searching the same for more than a week. now got a solution.. thank you guys …

  • @alen – Glad to help :)

  • If you were here I’d kiss you!

    Had left this till last on a site I’ve just done and wasn’t looking forward to the hours of debugging I was expecting.

    Fixed in 5 mins!

    TVVVVVVM

  • Hi there,

    Can somebody help me by telling me how can i use these 2 scripts in one page :

    window.addEvent(‘domready’, function(){check = new FormCheck(‘third’, {
    display : {
    fadeDuration : 500,
    errorsLocation : 1,
    indicateErrors : 1,
    showErrors : 1
    }
    })});

    and :

    ddsmoothmenu.init({
    mainmenuid: “smoothmenu1″, //menu DIV id
    orientation: ‘h’, //Horizontal or vertical menu: Set to “h” or “v”
    classname: ‘ddsmoothmenu’, //class added to menu’s outer DIV
    //customtheme: ["#1c5a80", "#18374a"],
    contentsource: “markup” //”markup” or ["container_id", "path_to_menu_file"]
    })

    ddsmoothmenu.init({
    mainmenuid: “smoothmenu2″, //Menu DIV id
    orientation: ‘v’, //Horizontal or vertical menu: Set to “h” or “v”
    classname: ‘ddsmoothmenu-v’, //class added to menu’s outer DIV
    //customtheme: ["#804000", "#482400"],
    contentsource: “markup” //”markup” or ["container_id", "path_to_menu_file"]
    })

    Thanks

  • OMG thank you, you are a live saver!!!!!!!!!!!!! :)

Leave your own!

Sponsors

fzilla file hosting

Popular Articles