Home > OS >  Explain the utility of the jQuery object (“$”)
Explain the utility of the jQuery object (“$”)

Time:02-25

$.trim() 
$.each() 
$.inArray() 
$.extend() 
$.proxy()
$.browser
$.contains()
$.data() 

Utility function in jQuery the same as utility jQuery object ("$")? please explain the utility of the jQuery object (“$”)?

CodePudding user response:

It is a normal JavaScript Object. Has some functions and properties.

CodePudding user response:

The main functionality of jquery is to create a collection of elements and apply DOM manipulation on that collection, eg:

$(".class1").slideDown()

The utility functions provide additional methods that do not need or are not relevant to a collection of DOM elements. In most cases, these didn't exist in the browser at the time.

A perfect example is $.extends which is now available as Object.assign but was not available until IE-Edge.

Even something as "obvious" as string trim() wasn't available until IE10, so jQuery had this long before then.

Many jQuery utility functions have been deprecated now that newer browsers have built-in equivalents.

  • Related