div return value to parent
I have a form, and in that form I have a div that list a table of pet owners.
This table is loaded from a file called findowner.php.
After clicking on the row of a pet owner I want to use the variable I got $(this).attr('rowid'). This is the owners id. In the php file I get it like this:
Code:
Other td elements here for name, address, etc.
'<td>'.'<a id="tableid" href="#" rowid='.$rowid.' >'.$rowid.'</a>'.'</td>'.
Code:
$('a#tableid').click(function() {
var vpetowner = $(this).attr('rowid');
alert(vpetowner);
$('#petowner').val(vpetowner);
return false;
});
I can't seem to get the val(vpetowner) into the forms $('#petowner').
If I load the findowner by itself (for testing), the alert(vpetowner); line works. But if clicked from the div where loaded from the other file (editpets.php), it doesn't alert and the $('#petowner').val(vpetowner); doesn't update.
How would I properly pass this from the div to parent?