Reputation: 1126
I have a weird problem with jQuery, the "$" becomes undefined after executing all the code under the ready event.
Any experience in this error? or any idea what is causing this?
Upvotes: 0
Views: 777
Reputation: 1042
use like this
<script type="text/javascript">
var $ = jQuery.noConflict();
(function ($) {
$(document);
// your code
}(jQuery));
</script>
Upvotes: 0
Reputation: 10967
Put jQuery code inside this snipet, because $ might be defined for something else.
(function($) {
// $ Works! You can test it with next line if you like
// console.log($);
})( jQuery );
Upvotes: 1