Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Isolation

Tags:

jquery

My company has a web application that has a plain javascript in it, and it use $ -"dollar symbol" in it's own way as shown:

function $(e) {
    return document.getElementById(e);
}

The problem is when I embed the jquery to the page there is a conflict occurs. Is there a way that I can isolate the jquery example:

$$(this) - is to call jquery and $(this) - to call old staff

please help me thank you

like image 709
InGeek Avatar asked Nov 17 '25 21:11

InGeek


1 Answers

Just make sure you include your lib first, then call

$.noConflict();
var $$ = jQuery;

That will restore $ to what it used to be before jQuery was parsed and make $$ point to jQuery http://api.jquery.com/jQuery.noConflict/

like image 94
Juan Mendes Avatar answered Nov 19 '25 12:11

Juan Mendes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!