AJAX innerHTML problem

  • Thread starter nogueira_cristina
  • Start date
N

nogueira_cristina

Hello,

I hope someone can clarify the following for me.

I have page which replaces the code of a certain <div> tag with other
code (which on itself contains another div).
The replacing of the code is done with AJAX.
All divs have their id's set.
The first replacement works fine.
But I want the code in the second div (which is code that has been put
in by the first replacement) to be replaced by the use of AJAX again.
Somehow i can read the code which is in this second div. But replacing
it doesn't work.

Here is the example:
This is the code that is put in a div with the first replacement.
In this code there is a div called "divslct2" which contains a select
box which needs to be replaced
by other code depending on the first select box.
The changeSlct() function uses AJAX to replace this code.
If i put this code directly in the initial page that is loaded (so it
won't be inserted by the first replacement) it works all fine. But
when it's inserted by AJAX, i can't replace the code within the the
div "divslct2". While i can read the code inside it just fine.
What is going wrong?

<form method="get" name="testform">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>1a</td>
<td>
<select name="slct1" onChange="changeSlct('divslct2');">
<option value="s11">1</option>
<option value="s12">2</option>
</select>
</td>
<td>1b</td>
<td>
<div id="divslct2">
<select name="slct2" id="slct2">
<option value="s21">1</option>
<option value="s22">2</option>
</select>
</div>
</td>
</tr>
</table>
</form>
 
C

Captain Paralytic

Hello,

I hope someone can clarify the following for me.

I have page which replaces the code of a certain <div> tag with other
code (which on itself contains another div).
The replacing of the code is done with AJAX.
All divs have their id's set.
The first replacement works fine.
But I want the code in the second div (which is code that has been put
in by the first replacement) to be replaced by the use of AJAX again.
Somehow i can read the code which is in this second div. But replacing
it doesn't work.

Here is the example:
This is the code that is put in a div with the first replacement.
In this code there is a div called "divslct2" which contains a select
box which needs to be replaced
by other code depending on the first select box.
The changeSlct() function uses AJAX to replace this code.
If i put this code directly in the initial page that is loaded (so it
won't be inserted by the first replacement) it works all fine. But
when it's inserted by AJAX, i can't replace the code within the the
div "divslct2". While i can read the code inside it just fine.
What is going wrong?

<form method="get" name="testform">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>1a</td>
<td>
<select name="slct1" onChange="changeSlct('divslct2');">
<option value="s11">1</option>
<option value="s12">2</option>
</select>
</td>
<td>1b</td>
<td>
<div id="divslct2">
<select name="slct2" id="slct2">
<option value="s21">1</option>
<option value="s22">2</option>
</select>
</div>
</td>
</tr>
</table>
</form>

Since you have not posted any of the code that performs the task,
there is nothing we can advise you on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top