javascript - Mozilla form.submit() not working -


i creating dynamic form using following code,

function createform() {     var f = document.createelement("form");      f.setattribute('method',"post");     f.setattribute('action',"./upload");     f.setattribute('name',"initiateform");     f.acceptcharset="utf-8";      var name = document.createelement("input");     name.setattribute('type',"text");     name.setattribute('name',"projectname");     name.setattribute('value',"saket");      f.appendchild(name);      f.submit();  } 

but in mozilla nothing happens code works expected ( in chrome). code being called function invoked button on click event. after executing code returning false.

please me out. in advance :-)

you need append new created form document, because not there on page load.

try this:

function createform() {     var f = document.createelement("form");      f.setattribute('method',"post");     f.setattribute('action',"./upload");     f.setattribute('name',"initiateform");     f.acceptcharset="utf-8";      var name = document.createelement("input");     name.setattribute('type',"text");     name.setattribute('name',"projectname");     name.setattribute('value',"saket");      f.appendchild(name);     document.body.appendchild(f); // added     f.submit(); } 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -