/    Sign up×
Community /Pin to ProfileBookmark

How i do solve a Jquery conflict

The following code is needed for the prettyphoto javascript popup. It works fine in Firefox and Safari, but not in any version of IE. Can anyone suggest why?
<script>
jQuery.noConflict();
$(document).ready(function(){
jQuery(“a[rel^=’prettyPhoto’]”).prettyPhoto();
});
</script>

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@KorAug 07.2009 — Can anyone suggest why?
[/QUOTE]

Probably because there is no absolutely full and forever crossbrowser framework. Frameworks do have their limits. If you need to have 100&#37; control upon a code, [I]do it by yourself[/I]. Otherwise, cross your fingers, prey for mercy and hope for the best.
Copy linkTweet thisAlerts:
@steshaw50authorAug 07.2009 — i now think its something to do with a jquery clash, but as im a beginner with javascript, i have no idea what could be clashing? If it was 'ready' for example, how could i change this?
Copy linkTweet thisAlerts:
@KorAug 07.2009 — Ask Jeff Mott to help you. He's a moderator and a JQuery expert.
Copy linkTweet thisAlerts:
@Jeff_MottAug 07.2009 — steshaw50,

After you call jQuery.noConflict(), then "$" is no longer a shortcut to jQuery. That means

[color=red]$[/color](document).ready(function(){



needs to be changed to



[color=blue]jQuery[/color](document).ready(function(){
Copy linkTweet thisAlerts:
@steshaw50authorAug 10.2009 — Jeff, i already tried your suggestion previously as i thought it could be a solution, however it simply made the prettyphoto script work in no browsers at all.

Is there anything within the script that could be clashing with another js script?
Copy linkTweet thisAlerts:
@Jeff_MottAug 10.2009 — Honestly, it's the code in your first post that shouldn't work in any browser. So you have something very odd going on in your code. You'll need to post a link to the actual page so we can take a look.
Copy linkTweet thisAlerts:
@steshaw50authorAug 10.2009 — ok, thanks for the reply firstly. So if the following is correct...

<script>

jQuery.noConflict();

jQuery(document).ready(function(){

jQuery("a[rel^='prettyPhoto']").prettyPhoto();

});

</script>

What within this script could possibly be clashing with another js script?

If it was 'ready' for example, would changing it to 'ready2' work, for example?
Copy linkTweet thisAlerts:
@Jeff_MottAug 10.2009 — There's really nothing in there that would clash with anything else. The real problem would seem to be elsewhere in your code.
×

Success!

Help @steshaw50 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...