How do I tell my jquery script to use something else than $ ?
Do I have to change all the $ to _$ ?
This is my script
$(document).ready(function() {
$('.slideshow').cycle({
fx: 'fade',
timeout: 6000
});
});
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
How do I tell my jquery script to use something else than $ ?
Do I have to change all the $ to _$ ?
This is my script
$(document).ready(function() {
$('.slideshow').cycle({
fx: 'fade',
timeout: 6000
});
});
Hi,
try this in your script:
(function($) {
$(document).ready(function(){
// your jquery awesomeness.
})
})(jQuery);
more info here: http://doc.silverstripe.org/javascript
Cheers,
Christian
Works like a charm. Thank you!
Or use JQuery.NoConflict
To expand on biapar's reply, something like this will stop your custom scripts from interfering with other scripts already using the $ namespace / function:
$.noConflict();
jQuery(document).ready(function() {
jQuery('#myid').click(....)
});