MyBB Community Forums

Full Version: jQuery api problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Having an issue where I'm trying to get this jQuery script to work.
To do so I'm putting this line in the headerinclude template:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

Which, along with the other script, works great. But the problem is that when the above line's there, it stops jquery working on the rest of the site: delete button disappears; quickquote (plugin) button disappears; along with the rest of my jquery plugins or things on the site.

Seems to be a jQuery conflict issue. I've had a look at trying to put in jQuery.noConflict();, but it seems too much of a hassle to do it to all the plugins, and well.. I don't understand the coding that much and don't know where to go from here.

Help would be appreciated, thanks.
The problem is that MyBB currently uses Prototype for its core JS. The only thing you can do is use jQuery.noConflict() I'm afraid.
Would it be possible to use jQuery.noConflict() on the jquery.min.js code, or are you saying I'd have to go through MyBB doing it to each feature affected? D:

ty for replying btw.
Just add a

<script type="text/javascript">
jQuery.noConflict();
</script>

To your headerinclude template below where you've linked your jQuery file.
^ Gave that a go, but to no avail.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<script>!window.jQuery && document.write('<script src="jquery-1.4.3.min.js"></script></script>
<script src="jquery.raptorize.1.0.js"></script>
<script type="text/javascript">
     $(window).load(function() {
          $('.myButton').raptorize();
     });
</script>

It only seems to be having trouble with that first line, unfortunately it seems that I need that to make 'myButton' work.
Try this instead:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<script type="text/javascript">window.jQuery || document.write('<script src="jquery-1.4.3.min.js"><\/script>')</script>
<script type="text/javascript" src="jquery.raptorize.1.0.js"></script>
<script type="text/javascript">
     jQuery(window).load(function($) {
          $('.myButton').raptorize();
     });
</script>

You had some of your code wrong.
Still no joy Sad
Try this:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<script type="text/javascript">window.jQuery || document.write('<script src="jquery-1.4.3.min.js"><\/script>')</script>
<script type="text/javascript" src="jquery.raptorize.1.0.js"></script>
<script type="text/javascript">
     jQuery(window).load(function($) {
          jQuery('.myButton').raptorize();
     });
</script>
You got it!

Thanks heaps for both of your help.
If you want to see what it's done, it makes the link in the top right (" - ") work on www.kiejr.com