What problems does jQuery solve? -


i understand jquery powerful javascript framework , have completed few tutorials. however, assist understanding, know class of problems jquery written solve. how make coding javascript easier? example or 2 of native javascript code , equivalent using jquery useful.

jquery's syntax designed make easier navigate document, select dom elements, create animations, handle events, , develop ajax applications. jquery provides capabilities developers create plug-ins on top of javascript library. enables developers create abstractions low-level interaction , animation, advanced effects , high-level, theme-able widgets. modular approach jquery library allows creation of powerful dynamic web pages , web applications.

https://en.wikipedia.org/wiki/jquery

example dom selection , class adding

the plain javascript:

function addclassf(el, cls) {   var clss;   if (typeof cls === "string") {     clss = cls.split(" ");   } else if (cls instanceof array) {     clss = cls;   }   var = 0,       len = clss.length;   (; < len; i++)   el.classlist.add(clss[i]); }  var foo = document.getelementbyid( "foo" ); // returns plain dom element addclassf(foo, "class1"); 

with jquery:

var $foo = $("#foo"); // returns jquery object $foo.addclass("class1"); 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -