3 ms·
Man, 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
by DanHulton 18y ago
Man, 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.