Jump to content

jquery - change height of dynamically added div


RIRedinPA

Recommended Posts

I'm trying to set the height of a div that gets added after a ajax call...I thought this code would work but it's failing...

 

//set height of datagrid
var gridheight = $(window).height() * .95;
$('#datagrid').css("height", gridheight);

 

the div is generated in this code...

 


...

//build table/grid

$tablecode = "<div id=\"gridheader\"><p class=\"gridheader itemname\">App Need</p>";
$tablecode .= "<p class=\"gridheader itemrequestor\">Requestor</p>";
$tablecode .= "<p class=\"gridheader itemcat\">Category</p>";
$tablecode .= "<p class=\"gridheader itemdesc\">Description</p></div>";

$tablecode .= "<div id=\"datagrid\"><ul>";

$r=0;
foreach($tabledata as $itemdata) {
$r++;
$itemid = $itemdata['id']; 
$itemname = $itemdata['wish'];
$itemdesc = $itemdata['description'];
$itemrequestor = $itemdata['requestor'];
$itemcat = $itemdata['category'];

$tablecode .= "<li class=\"gridrow\" id=\"" . $r . "\">
				<div id=\"row_" . $itemid . "\"><p class=\"itemname gridcell\" itemid=\"" . $itemid . "\">" .  $itemname . "</p>
				<p class=\"itemrequestor gridcell\">" . $itemrequestor . "</p>
				<p class=\"itemcat gridcell\">" . $itemcat . "</p>
				<p class=\"itemdesc gridcell\">" . $itemdesc . "</p></div></li>";
}

$tablecode .= "</ul></div>";

...

 

any idea why I can't target that div? Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.