RIRedinPA Posted August 2, 2010 Share Posted August 2, 2010 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. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 3, 2010 Share Posted August 3, 2010 The call is being made after the div has been generated yes? See if you can access any properties of the div, just by alert() or if you're using Firebug console.log(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.