I am a lil new to JQ. I have a table and each row has a unique id like so <tr id="123">.
I have a edit button in one of the fields on that row, and I want to turn that row into a form.
How can I grab all the values of each field in that row?
Here is what the table looks like now.
<tr id="e2c420d928d4bf8ce0ff2ec19b371514">
<td><div id="item_name">asdf (asdf)</div></td>
<td><div id="edit">Edit</div></td>
<td><div id="item_description">asdf</div></td>
<td><div id="item_price">1234</div></td>
<td><div id="item_qty">1</div></td>
<td><div id="item_total">1234</div></td>
</tr>
<tr id="b2x4123928d4bf8ce0ff2ec19b372138">
<td><div id="item_name">asdf (asdf)</div></td>
<td><div id="edit">Edit</div></td>
<td><div id="item_description">asdf</div></td>
<td><div id="item_price">1234</div></td>
<td><div id="item_qty">1</div></td>
<td><div id="item_total">1234</div></td>
</tr>
I think you should be using classes and
data-idattributes, but it is up to you.What you need is (assuming you are using jquery 1.4.2+)
Read up more on
.delegateand.closest. They are less used but awesome methods.