Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAnuj Taxali
2,712 PointsAcessing HTML elements using regular javascript
Can someone confirm my understanding? So far, this is how I understand it:
HTML elements can also be accessed without jQuery, i.e. with regular javascript. For example, we can access the same warning class like this: document.body.children[0]; or, in modern browsers: document.getElementByClassName(warning)[0]; However, jQuery is more efficient and provides better cross-browser support
Am I right on this? Thanks in advance
1 Answer
jason chan
31,009 Pointsjavascript is faster, but jquery is makes thing easier. If you want jquery to be quick you have to know the nitty gritty and refactor it well.
Gunhoo Yoon
5,027 PointsGunhoo Yoon
5,027 PointsPretty much. You can do almost all things that JQuery can do by interacting with DOM API using native JavaScript but it gets pretty verbose without accomplishing much things and you need to write codes for compatibility. There are many debates on online not to use jqueries on some situation due to performance so you can look that up if you are curious.