All about jQuery – common methods! (P.2)

Tram Ho

I would like to introduce to you the entire collection of the most commonly used, most detailed jQuery

I would like to continue to introduce to you p2 of the jQuery retreat, if you have not seen part 1, please review at this link

In the previous section, we went through the most basic, most used functions of jQuery in this series.

Access to the elements:

  • For example, we have the following HTML, now we want from #here and want to access the nearest parent.

we do the following:

In addition, you can laasy the form selectors as follows:

Add elements

  • In the previous lesson, we learned about types such as: append, after, before, prepend … with this article I will show you other ways to customize the scene to use.

  • And the result is like this, very fast and neat

Remove unnecessary duplicates:

Loop the elements

Seems like there are enough ways to interact with the element then, so far will be ajax and how to use them

  • With the concept, you look on gg sure full, here I just want to mention to you its use is t take a piece of data from the server without reloading the page and displaying them on the browser.

$ .get ()

  • With the simple get data functions, t just use this method very quickly and conveniently
  • The main way of doing things is to simply pass 1URL and the first parameter, the data returned in function () or 1 Promise
  • With the second parameter as an option, if k has t, you can always omit the function () return here

$ .post ()

  • If you have get, there must be a post right?
  • With parameters and the way it works like $ .get but it is used for the purpose of posting data on the server

$ .ajax ();

  • With the $ .get and $ .post functions we only work with basic operations, so what does $ .ajax () do?
  • Actually it is like the other two functions but there are more options for us to use in many ways

With that is all the jQuery functions “I often use”, besides there are other great functions, please refer to the document. I would like to close here, hope you support me with the next series. thanks for watching (bow)

Share the news now

Source : Viblo