+ 1

can you manipulate the DOM with only jQuery without javascript ? if so which of the two is most effective ?

like just directly start start typing in the external js file $(function) {//code}

21st Nov 2017, 3:03 PM
Francis jr Ngopola
Francis jr Ngopola - avatar
5 ответов
+ 1
jQuery is a library for JavaScript, written in JavaScript; when you're writting jQuery, you're essentially writing JavaScript but in a simplified manner. Everything you can do in jQuery, you can do in pure JavaScript. jQuery is much simpler to write and maintain, the only downside would be the slight overhead it requires compared to pure JavaScript.
21st Nov 2017, 4:35 PM
Nicolas Kik
Nicolas Kik - avatar
+ 2
Latest minified Jquey CDN : <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
21st Nov 2017, 4:23 PM
RZK 022
RZK 022 - avatar
+ 1
now i get it, you can manipulate it only with jQuery if you want but we should include the source of the library in our head tags...... but still which is the most effective?
21st Nov 2017, 3:39 PM
Francis jr Ngopola
Francis jr Ngopola - avatar
+ 1
jQuery is probably shorter to write if you are thinking about which one can be more "effective" in a small project. Though these days knowing how to use React, Vue or Angular is the new standard of web development so it is best you learn and use vanilla JavaScript and use them well. The practice of manipulating the DOM is a bad thing in general so the newer frameworks basically have Virtual DOM to make the page more efficient.
8th Dec 2017, 1:42 AM
wudifeixue
wudifeixue - avatar
0
1) If the "most effective" is defined as the shortest time to be executed by the browser then JavaScript is faster. jQuery is a JavaScript library . It needs to be loaded first and at the end before the browser can parse it it needs to be pure JavaScript. This being said I'm not sure how much delay it causes in the real situations. It depends on the project size/requirements. 2) The "most effective" on the "web" development side is jQuery - short code and cross-browsers compatibility. From: https://www.w3schools.com/jquery/jquery_intro.asp "jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on your website. jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code. jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation. The jQuery library contains the following features: HTML/DOM manipulation CSS manipulation HTML event methods Effects and animations AJAXUtilities"
20th Dec 2017, 2:27 PM
OC1
OC1 - avatar