Knowing the basics of jQuery helps.  Then being able to project what you 
know for the easy problems onto the harder problems is also a good 
skill.  In this case, knowing the basics that .text() gets the text of 
an HTML element is the starting point.  This is defined in the docs, and 
after some digging should be rather simple to use.  Then applying this 
to the more complex problem of getting the text of a table cell... well 
a table cell is an HTML element as well, so doing something like
$("#mytablecell").text() should work.  But in your case you didn't have 
a reference to the cell - just the row.  So we need apply some jQuery 
selector magic (i.e. combining some selector methods) to arrive at a 
reference to the desired cell.  This results in
$("#myTR td:eq(3)").text();
- assuming you wanted the 4th cell.

As you gain more experience with the language, and JavaScript in 
general, this will become second nature and you rarely need to think 
things out.  The answers become obvious (sometimes).

As for the .rowIndex and .cellIndex tips, that is core JavaScript and 
DOM coding, and isn't a jQuery thing at all (though I'm sure jQuery 
makes use of those properties in places).  To know these points off the 
top of your head means to understand and/or have some experience doing 
DOM coding.

So in short, he knew the answer because of his past experience... :) 
I'm just too long winded to put it that way.. LOL

As for learning the ins/outs of jQuery, well the simple answer is to "do 
it".  The more you work with jQuery (and JavaScript), the easier it 
becomes.  But having a solid JavaScript background really helps too.  By 
that I mean that if you can do the things jQuery does, without using 
jQuery, and understand the whys and fors of these techniques, then using 
jQuery becomes much easier.  For instance, build a couple of Ajax 
routines the "traditional" way.  Then the jQuery Ajax routines make 
perfect sense.  Or write some animation routines (like the slideUp/Down) 
without using jQuery...  You'll get a better appreciation for the 
shortcuts jQuery gives you, but more importantly you'll have a better 
idea how you can "tweak" these shortcuts to do exactly what you want.

Ok, I'm done typing now. :)  Hopefully this answers your questions or 
helps you out some...

Shawn

Monica wrote:
> Thanks for the replies.
> 
> So tell me, how did you know the answers. I have the "Learning jQuery"
> book by Chaffer and Swedberg. I poured over the table manipulation
> chapter with no clarity!!! So the question is : What'e the best/smart
> way to learn JQuery ins and outs? Go through the jquery.js? Thanks!

Reply via email to