Solved

jquery conflict

Posted on 2013-11-06
5
272 Views
Last Modified: 2014-11-03
I have mvc app. it is very simple and have one view (date picker).
The issue is when I addded

 <script src="../../Scripts/jquery.js" type="text/javascript"></script>

in the _layout.cshtml. The data picker in jquery is no longer working.

And just wonder how to fix it.

Thanks

codes below

 <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>


    <link href="@Url.Content("http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css")" rel="Stylesheet" type="text/css"   />

    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
0
Comment
Question by:solution1368
5 Comments
 
LVL 58

Expert Comment

by:Gary
Comment Utility
What is jquery.js? You say conflict - what is conflicting?
0
 
LVL 42

Expert Comment

by:Chris Stanyon
Comment Utility
Difficult to say without seeing the generated HTML, but from what you've shown it looks like you might be including 2 different jQuery libraries: jquery-1.5.1.min.js and jquery.js. That will cause conflict.
0
 

Author Comment

by:solution1368
Comment Utility
Chris: Yes, I agree, just don't know how to fix it.
0
 
LVL 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
Comment Utility
You said the issue started when you added:

<script src="../../Scripts/jquery.js" type="text/javascript"></script>

so don't add it!

If you're already including jQuery once, why do you need to add it again?
0
 
LVL 28

Expert Comment

by:Pravin Asar
Comment Utility
You may use noconflict() method.

See docs @

http://api.jquery.com/jquery.noconflict/
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now