+ 1

jQuery

What is jQuery really used for? And what is or are its advantages over native JS?

17th Jul 2017, 9:41 PM
Power'f GOD⚡⚡
Power'f GOD⚡⚡ - avatar
4 Answers
+ 9
For handshorting JS writing essentially, and providing easier cross browers support handling mainly... it provide also a bind for such relative complex API as to handle AJAX ^^ With success, it have provided some extension as JQueryUI to handle layout effects...
17th Jul 2017, 9:50 PM
visph
visph - avatar
+ 3
It makes you easier to code saving your time and making simplier some things. For example you have 3 Paragraphs and you'd like to change bgcolor and font-style for each of them: <p>One</p> <p>Two</p> <p>Three</p> So you'll have code like this in JavaScript: <script> let ps = document.getElementsByTagName('p'); for (let i=0; i<ps.length; i++) { ps[i].style.background = 'red'; ps[i].style.fontStyle = 'italic'; } </script> And like this - in jQuery: <script> $('p').css({'background':'red', 'font-style':'italic'}); </script> And one more line is in <head> to import jQuery support to your page scripts: <script src="https://code.jquery.com/jquery-3.2.1.js"></script>
18th Jul 2017, 2:00 AM
Alex Sweetheart
Alex Sweetheart - avatar
+ 1
OK. Thanks, mate.
18th Jul 2017, 4:22 AM
Power'f GOD⚡⚡
Power'f GOD⚡⚡ - avatar
- 2
JavaScript query maybe
17th Jul 2017, 9:42 PM
Malose