If Prototype is included in the page already, I have to do this:
jQuery(document).ready(function()
{
for inline jQuery scripts instead of this:
$(document).ready(function()
{
But if I have an included jQuery file on th开发者_如何学运维e same page that uses $
, that does not seem to conflict, e.g.:
<script type='text/javascript' src='/js/included.js'></script>
In other words, I don't have to edit included.js
and change all of the $
to jQuery
.
Why the distinction: included files versus inline scripts?
included may be playing safe and deliberately shadowing $
(function($) {
// included.js code here
})(jQuery);
精彩评论