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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.