I have a form loading on a page that loads with an onclick event on the parent page using the following javascript. It gets loaded in a DIV.
function loadContent(elementSelector, sourceURL) {
$(""+elementSelector+"").load("http://myurl.co.nz/"+sourceURL+"");
}
Then on another on click event (within the new form) one of the fields in the form is populated with a random password.
<label>Password:</label><input type="text" name="password" /><br/>
<input type="button" value="Generate Password" onClick="genPwd()"/>
function genPwd(){
$.post("rpc.php", {
method: "genPwd"
},
function(data,textstatus){
document.form.password.value = data.message;
}, "json");
}
All the javascript on the page is included at load time.
Chrome and FF are fine with this but IE8 says that document.form.password does not exist, I assume because it is not in the original page. Any way around this?
Cheers