5 ms·
jQuery FTW
by wenbert 18y ago
jQuery FTW
- axod 18y agoDo it yourself FTW
- DanHulton 18y agoMan, YOU write jQuery's selectors yourself. Maybe you even could, but why would you want to? jQuery's the most excellent basic "toolkit" javascript product I rely on.
- axod 18y agoWhy do you need selectors like that? just give things IDs if you need to reference them... Oh well :) Maybe I'll try a javascript library properly one day.
- DanHulton 18y agoWhat if you wanted to get an array of all the table cells in a particular table? $('#tbl-order td') versus - Getting the table - Getting the table body - Getting each row - Getting each cell Much simpler. It's cool though, I dismissed it until I tried it too. It's a real eye-opener how much easier things are using jQuery's selectors.
- axod 18y agoIf you want to get an array of all the table cells in a table, you're probably using the DOM to store data, instead of display data, which is bad IMHO. I prefer having the data in js, pointing to nodes in the DOM, or containing IDs that may need adjustment, updating.
- DanHulton 18y agoOr you're adding rollover events to the table, or styles to the table. Also, the DOM's not a bad place to store data. Why duplicate it elsewhere if it's already in-place in a table? This allows you to say, gracefully upgrade your simple HTML table to a YUI DataTable if your user has javascript enabled.
- axod 18y agoThat's like using a video cards display ram to do inter process communication, or store other program data. Sure though, if you want to add things to a table once loaded to be unobtrusive I can see that use. Although then I'd say just give them sane IDs, and have a js array with the IDs you need to update.
- riklomas 18y agoYou can make just as obtrusive Javascript using jQuery as much as you can with any JS library, the point is that you should be doing unobtrusive Javascript. If you don't know how to do unobtrusive JS, I would recommend DOM Scripting by Jeremy Keith: http://www.amazon.co.uk/DOM-Scripting-Design-JavaScript-Document/dp/1590595335/ http://www.amazon.co.uk/DOM-Scripting-Design-JavaScript-Docu...