Site icon Puneet Sharma – Freelance Web Developer

How to use jQuery with other JavaScript functions without any conflict

To release $ that jQuery also uses us jQuery noConflict() Method

$.noConflict();
jQuery(document).ready(function(){
    jQuery(“button”).click(function(){
        jQuery(“p”).text(“jQuery is still working!”);
    });
});

var jq = $.noConflict();
jq(document).ready(function(){
    jq(“button”).click(function(){
        jq(“p”).text(“jQuery is still working!”);
    });
});

$.noConflict();
jQuery(document).ready(function($){
    $(“button”).click(function(){
        $(“p”).text(“jQuery is still working!”);
    });
});

https://www.w3schools.com/jquery/jquery_noconflict.asp

Exit mobile version