Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Javascript Conflicts - Javascript not working *SOLVED*


Reply


4 Posts   3526 Views

Avatar
CHD

Community Member, 218 Posts

4 January 2011 at 3:39pm

Hey,

i was pulling my hair out with this for a while.
I've been using custom JavaScript sideshows etc in my sites, but they stop working on pages with "image gallery" or "userdefinedforms" etc.

anyway, the solution was the JavaScript libraries conflicting with the use of "$"
putting this as the very end of my code solved it:

<script>
jQuery.noConflict();
jQuery(document).ready(function($){
$("#example").autocomplete();
});
</script>

I hope this helps others!

Avatar
DNS

Community Member, 1 Post

9 January 2011 at 8:54am

Thanks much... this just saved me some troubleshooting.

Avatar
edwardlewis

Community Member, 32 Posts

16 April 2011 at 10:50pm

where abouts do you put the code? in page.ss or in the js file that is causing the conflict?

Avatar
edwardlewis

Community Member, 32 Posts

16 April 2011 at 10:57pm

yes! just fixed it..

I used:

(function($) {
$(document).ready(function() {

// code;
})
})(jQuery);

at the top and bottom of the js file