Thursday 16 February 2012

jQuery: what if another javascript library uses $?

Background: jQuery uses $() as an alias to the function jQuery().

The problem:What if another library uses the same character? (e.g. Prototype; other libraries???)

Solution:Make jQuery not use to ${} by calling $.noConflict()

Code taken from jQuery.noConflict():
<script type="text/javascript">
  $.noConflict();
  // Code that uses other library's $ can follow here.
</script>

References

No comments:

Post a Comment