dru dru - 6 months ago 43
jQuery Question

Set hidden variable value equal to entire HTML of table

I'm trying to POST the entire HTML for a dynamic table to another page which will parse the HTML as an XLS file. I can't seem to get the onClick jQuery correct though, as the generated .XLS file just has contains one cell that reads :

[object Object]

onsubmit='$j("#datatodisplay").val( $j("#table1") ).html()'

is the name/id of the hidden variable,

is the table name.


Move your html() inside the val() function:

onsubmit='$j("#datatodisplay").val( $j("#table1").html())'