Hi
I have a link which runs an AJAX request which opens a DIV that contains an HTML form that contains other divs. I then run call a second javascript function which populates the form.
What I have discovered is that unless I have some kind of pause the function that populates the form comes up with an error as the div contained with form doesn't yet exist.
To fix this I have added the following code:
This works fine in IE - you just get one alert box and by the time you click it you are good to go so the function ends and the form is filled in.
However in Chrome the alert box keeps opening up - i.e. document.getElementById('detailsPreviewDiv') remains NULL which it clearly isn't!
Any ideas?
Thanks very much
Ed
I have a link which runs an AJAX request which opens a DIV that contains an HTML form that contains other divs. I then run call a second javascript function which populates the form.
What I have discovered is that unless I have some kind of pause the function that populates the form comes up with an error as the div contained with form doesn't yet exist.
To fix this I have added the following code:
Code:
function waitForDetailsPreviewDiv()
{
while (document.getElementById('detailsPreviewDiv')==null)
{
alert('Edit signature and click Save Changes');
}
}
This works fine in IE - you just get one alert box and by the time you click it you are good to go so the function ends and the form is filled in.
However in Chrome the alert box keeps opening up - i.e. document.getElementById('detailsPreviewDiv') remains NULL which it clearly isn't!
Any ideas?
Thanks very much
Ed