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?

Link to comment
Share on other sites

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