Is the jquery still relevant in 2018? (jquery has great significance in 2018)

Source: Internet
Author: User

DOM Selection

$ ('. SomeClass ')

Document.queryselector ('. SomeClass ')

Document.queryslectorall ('. SomeClass li ')

DOM manipulation//manipulation manipulation

$element. Remove ()

$element. prepend (otherelement)

$element. Before (otherelement)

$element. addclass (' SomeClass ')

$element. Removeclass (' SomeClass ')

$element. Toggleclass (' SomeClass ')

Const PARENT = $element. Parent ()

Const CLONED = $element. Clone ()

Vanilla://Normal

Element.remove ()

Element.prepend (otherelement)

Element.before (otherelement)

Element.classList.add (' SomeClass ')

Element.classList.remove (' SomeClass ')

Element.classList.toggle (' SomeClass ')

Element.classList.toggle (' SomeClass ')

Const PARENT = Element.parentnode

Const COLINED = Element.clonenode (True)

Element.prepend (Other)

Events

$someElement. On (' click ', Function (e) {

Logic

});

Someelement.addeventlistener (' click '. e=>{

Logic

});

HTTP Requests/ajax

JQuery is MUCH easier than using the XHR object to make Ajax calls. Now we have the Fetch and other specialized libraries.

Fetch (' http://api.something.com ')

. Then (res = Res.json ())

. Then (data = console.log (data))

Axios.get (' http://api.something.com ')

. Then (res = Console.log (res,data))

Utilities

$.isarray (somevalue) Array.isarray (somevalue)

$.inarray (Item,anarray) Somearray.indexof (item) <-1

$.each (Somearray, (Index,value) =>{}) Somearray.foreach ((Value,index) =>{})

$.map (Somearray, (Value,index) =>{}) Somearray.map ((Value,index) =>{})

$.grep (Somearray, (Value,index) =>{}) Somearray.filter ((Value,index) =>{})

$.parsejson (str) json.parse (str)

Animations

Animation with Vanilla JS was one thing that's MUCH more difficult than with jQuery but there be many other options

· CSS Transitions/keyframes

· Web Animation API

3rd party libraries like Greensock

Not on the future and now.

Is the jquery still relevant in 2018? (jquery has great significance in 2018)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.