Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The list of most commonly used jQuery API functions

Here is the list of most commonly used jQuery API functions:

  • find(): Selects elements based on the provided selector string
  • hide(): Hides an element if it was visible
  • show(): Shows an element if it was hidden
  • html(): Gets or sets an inner HTML of an element
  • append() Injects an element into the DOM after the selected element
  • prepend() Injects an element into the DOM before the selected element
  • on(): Attaches an event listener to an element
  • off() Detaches an event listener from an element
  • css(): Gets or sets the style attribute value of an element
  • attr() Gets or sets any attribute of an element
  • val(): Gets or sets the value attribute of an element
  • text(): Gets the combined text of an element and its children
  • each(): Iterates over a set of matched elements
@chriswburke

This comment has been minimized.

Copy link

@chriswburke chriswburke commented Feb 26, 2016

How was this list determined?

@CraigglesO

This comment has been minimized.

Copy link

@CraigglesO CraigglesO commented Sep 10, 2016

What about .animate(obj,time,callback): animates the obj (except color, you have to add jquery.ui)
animate is almost by far my favorite.

oh and toggle
fade(In/Out/Toggle)
... so many more to add to this list

@basiclaser

This comment has been minimized.

Copy link

@basiclaser basiclaser commented Nov 23, 2016

Also curious, where did you find this data? Or is it an educated guess, or your personal usage?

@rolandin

This comment has been minimized.

Copy link

@rolandin rolandin commented Mar 26, 2017

Sounds about right.
Please if some one has favorites used methods like CraigglesO with animate(), please share.
Might help others, I've been using animate.css framework for animations, I'm gonna dig a little bit more into animate() to see what kind of things I can reach.. although, is not better do the animations with CSS as long as we could be able to do them ??

@tejas-kr

This comment has been minimized.

Copy link

@tejas-kr tejas-kr commented May 12, 2017

hey .toggle() is used more frequently than .hide() and .show()

@bonucci

This comment has been minimized.

Copy link

@bonucci bonucci commented Sep 6, 2017

.toggleClass()

@alex0121

This comment has been minimized.

Copy link

@alex0121 alex0121 commented Sep 27, 2017

offset(), scrollTop() and resize() are good too especially when you want to make a position fixed element responsive when it is not set to top: 0 or left: 0

@rakin92

This comment has been minimized.

Copy link

@rakin92 rakin92 commented Nov 22, 2017

how come .toggle() not included!

@ChrisHPZ

This comment has been minimized.

Copy link

@ChrisHPZ ChrisHPZ commented Dec 13, 2017

Agreed about .css I find I use it all the time, especially if I have to inject some height dimensions into a child div. outerWidth and outerHeight are another couple functions I use all the time.

@gtwade

This comment has been minimized.

Copy link

@gtwade gtwade commented Apr 9, 2018

This is probably a list that's relevant to the author more than a statement of what's truly essential jquery. Your own personal list will no doubt be different.

@BerinH

This comment has been minimized.

Copy link

@BerinH BerinH commented May 21, 2018

append appends inside the selected element in the last position.
Ditto for prepend, only at the start. Useful list though :-).

@k3kenan

This comment has been minimized.

Copy link

@k3kenan k3kenan commented Mar 22, 2019

Maybe you want to check out this:
tesodev/jqueryLite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.