简体   繁体   中英

How to resolve javascript files conflict?

I am using two JS below in my master page :-

<script type="text/javascript" src="~/Scripts/jquery-1.7.2.min.js"></script>
<script Src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"> </ script>

My problem is when I add the below JS file "1.10.3", one of my post back request sending two times.

But when I commented this JS "1.10.3" the multiple post back problem is resolve.And doing this,there is another javascript error is :-

"typeerror $(...).draggable is not a function"

And to resolve that error i have to include both the JS files.

Can anyone help me out on this ? I am working on ASP.NET MVC4.

Depending on the library, including it more than once could have undesired effects, because the functionality of JS may be conflicting. To avoid this add this code to your JavaScript Part.

<script>
    ...
    ...
    $.noConflict();
</script>

For More info about noConflict : Click Here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM