I want to
- hide the 2nd td inside a tr and,
- get the value of the 2nd td in the future.
how do i get to the value of the 2nd td?
- the second td inside a tr which is inside?
- the td with a class name “hide”
How could I code this out in Jquery?
I have something like this for starters:
$('#todolist').each(function () {
var $table = $(this);
$('td', $table).each(function () {
---code---
You can solve all these problems by reading the docs (especially on selectors) and the samples they contain.
See: http://api.jquery.com/category/selectors/
And you can play with jQuery very easily using jsfiddle.net as a sandbox. For example, here’s a fiddle I used to prepare answers to your questions.
Your specific questions:
Assuming the
tryou want is the first one, as opposed to hiding the 2nd td in all of them…Save off the
tdin a variable instead of directly executing functions against it. Then you can read the value using.text().jQuery uses CSS selector syntax. Use the CSS selector for IDs.
As for Question B1, "how do i get to the value of the 2nd td? the second td inside a tr which is inside?", I don’t understand what you’re asking…