TeddyKiller Posted June 26, 2010 Share Posted June 26, 2010 I have something like this - in php. <?php $onSiteContinuedDiv = ' <div style="height:1px; border:1px solid #DBE6F4; margin-bottom:6px; margin-top:4px;"></div> <table style="margin-left:40px;"> <tr> <td><span style="color:#e11919;">Sorry, you have not set any security questions. You cannot continue</span></td> </tr> </table>'; ?> <script>$(function() { $("onSiteDiv").html(<?=$onSiteContinuedDiv?>); });</script> This doesn't change the content of the onSiteDiv... and I'm not sure why. I'm wanting to change that content to $onSiteContinuedDiv ...how can I do it? What am I Missing? Link to comment https://forums.phpfreaks.com/topic/205924-changing-div-content-with-jquery-and-php/ Share on other sites More sharing options...
F1Fan Posted June 26, 2010 Share Posted June 26, 2010 Where's the rest of your code? Do you actually have a div with an ID of "onSiteDiv"? Link to comment https://forums.phpfreaks.com/topic/205924-changing-div-content-with-jquery-and-php/#findComment-1077620 Share on other sites More sharing options...
TeddyKiller Posted June 26, 2010 Author Share Posted June 26, 2010 Yeah. The codes long though.. I had to change it to something like this.. $onSiteContinuedDiv = ' <table style="margin-left:40px;"> <tr> <td style="text-align:right;">Secret Question</td> <td "style="text-align:left;">' . $row['secretQ'] . '</td> </tr> <tr> <td style="text-align:right;">Secret Answer</td> <td style="text-align:left;"><input type="text" size="30" name="onSiteSecretA" /></td> </tr> <tr> <td></td> <td><input type="submit" name="onSiteSubmit" class="button" /></td> </tr> </table> '; echo '<script> $(function() { $("#onSiteDiv").show(); $("#onSiteFirstForm").hide(); $("#onSiteContinuedDiv").show(); });</script>'; The overall div, is onSiteDiv.. but I've seperated it into two inner divs too. So.. one hides, one shows depending on whats what.. this works fine. but if I ever tried to use $("#mydiv").html("Some html"); it doesn't work.. it doesn't record the new html. It shows in the source code fine.. but it doesn't actually change the content of the div. Link to comment https://forums.phpfreaks.com/topic/205924-changing-div-content-with-jquery-and-php/#findComment-1077624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.