I'm a little confused on how to do this...
I have a table that has a series of rows, and within each cell, there are certain form elements. I'm trying to get the value from the "code" input field from the last row only, and am having trouble with the syntax...
Simplified table looks like this:
<table id="table1">
<tr><td><input type="hidden" name="code" value="XFT" /></td></tr>
<tr><td><input type="hidden" name="code" value="ETY" /></td></tr>
<tr><td><input type="hidden" name="code" value="DHQ" /></td></tr>
</table>
And, here's the jquery that doesn't work...
if($('#cont')) {
$("#cont').live('click', function(event) {
var tr = $('#wr-viewcarttable tr:last');
var itemcode = $(tr > 'input[name="code"]').val();
window.location = "/search?p="+itemcode;
});
}