Alaa
Alaa

Reputation: 217

Avoid jQuery conflict with multiple JavaScript library in asp.net

I am working on C#.net project, and I use multiple javascript libraries for menu and image sliders and other, but there is a conflict appeared, how can I avoid that?

Upvotes: 2

Views: 2807

Answers (1)

Aristos
Aristos

Reputation: 66641

Right after the load of the jQuery library you call the $.noConflict(); and then all your calls to jQuery are made using the jQuery keyword. Example from the jQuery site:

<script type="text/javascript" src="other_lib.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
  $.noConflict();
  jQuery(document).ready(function($) {
    // Code that uses jQuery's $ can follow here.
  });
  // Code that uses other library's $ can follow here.
</script>

Upvotes: 1

Related Questions