Webkul
Services
Technologies Bagisto QloApps
iOS Android SAP BigCommerce Wix
Trusted by
Samsung Intel Toyota Walmart Disney Nokia Nestlé Decathlon
See all customers
Back to Top
DOC

jQuery.noConflict Method to avoid Conflict b/w JS Library:

In this blog we will learn about jQuery.noConflict() or $.noConflict() method to
avoid the conflict between the jQuery library.
In the JavaScript library, we apply $ Symbol for variable names and methods.
jQuery is not an exception. Therefore we use multiple frameworks that use $ and
their application is different, it is recommended to apply the
jQuery.noConflict() or $.noConflict() method.

Why we use noConflict() Method:

If we are using two different frameworks with the same shortcut $ then one of them stops working due to conflict so to avoid the conflict between the two frameworks. we use $.noConflict() method.

Solution:

  1. jQuery team comes with the noConflict Method that is very useful when we use two or more different frameworks.
  2. In the JQuery noConflict() Method hold the $.

Syntax:

Syntax of noConflict method.

$.noConflict()

Example 1:

In this example, we will see how $.noConflict() method work:

blog_no_con1
image-14

Example2:

In this example, we will learn about how to create your own shortcut for jQuery.

blog_no_con2
image-15

Example3:

In this example, we will see how to avoid conflict when we will use two different libraries of jQuery on the same page.

blog_no_con3
image-21

hope, this blog can help you to understand the noConflict() method. Thanks

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home