Solve the conflict of jQuery's $ symbol

When designing the powerful jQuery framework, it not only considers its own symbol definition, but also considers the issue of peaceful coexistence with other frameworks. The all-encompassing design concept gives jq tenacious vitality.

A bit too much nonsense.

When the framework we use uses '$' as a reserved character, jQuery is free to release the usage of '$':

For example: we assume that such assignment processing is done in our framework (this is just a demonstration, no one will do it)

var $ = '666';

 Then obviously this $ symbol has a semantic conflict. At this time, we only need to release the $ semantics of jQuery to resolve the conflict:

jQuery.noConflict();

 Not only that, we can also reassign the freed semantic objects to achieve custom and concise effects: like this

var jQ = jQuery.noConflict(); 

 Can be assigned any value, so we can use this custom object instead of the $ sign next time.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326529705&siteId=291194637