Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use some external plugins (not wordpress plugins), that use '$', and it's very convenient for me to cancel noConflict mode, by adding this line
$=jQuery
But I guess they invented noConflict mode not for nothing.
The question is how much have to worry about it. And is really a problem to use $=jQuery?

share|improve this question
5  
I would question the quality of any plugin that relied on $ to function correctly. The jQuery docs are pretty clear on the subject and failing to follow this very simple convention is a huge red flag to me. –  Milo Jun 1 '13 at 23:38
add comment

1 Answer

up vote 4 down vote accepted

The problem with the $ alias is that a number of libraries quite puzzlingly decided to use the same variable as an alias. If two libraries try to use the same variable, one or the other will win and anything dependent on the other one will break.

If you are only using jQuery, and never anything else, it should be fine to use the $ but you should not ever do that except for a site that you personally maintain. I suspect you will regret it if you ever want to use another library, though. Using that hack in a plugin or a theme would be very bad form.

What you are doing is only marginally easier than this though (from the jQuery.noConflict docs):

(function($) {
  $(function() {
    // more code using $ as alias to jQuery
  });
})(jQuery);

But then I don't know what kind of "plugins but not WordPress Plugins" you are talking about, or whether that is even relevant.

Reference

http://api.jquery.com/jQuery.noConflict/

share|improve this answer
    
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.