Jump to content

Changing div content with JQuery and PHP.


TeddyKiller

Recommended Posts

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?

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.

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.