Try the following:
$('table#table1 tr:last input[name=code]').val();
Or, adjusted to your code:
$('#cont').live('click', function(event) {
var tr = $('#wr-viewcarttable tr:last');
var itemcode = tr.find('input[name=code]').val();
window.location = "/search?p="+itemcode;
});
You have two errors in the code, you have inappropriate quotation marks in part $("#cont'), and your input search is incorrect. Now you have:
$(tr > 'input[name="code"]').val();
> , , , tr 'input[name="code"]'. (true false), :
$(true).val();
. jQuery, find , , $(). , :
tr.find('input[name=code]').val();
$('input[name=code]', tr).val();
tr , , .