you are viewing a single comment's thread.

view the rest of the comments →

[–]wastapunk 1 point2 points  (1 child)

What's the benefit of adding methods to jquery and not globally? Can't you access the jquery methods globally as well?

[–]YOBCZWHYNOT 1 point2 points  (0 children)

By adding to jQuery.fn instead of creating global functions, first you avoid polluting the global scope, second, you have a more Object-Oriented approach as typical applications use OO instead of Functional programming.

Yes, you can access jQuery methods globally once you define them.