Mar 25, 2019 Understand the root cause of the error, solve it, and never make the mistake again. Learn to use path, addpath, which and pwd. 1h de formation offerte: « Comment j’ai investi dans un immeuble de rapport de 6 appartements avec un rendement de 10% net ».
how can I go about creating a form with javascript?
I have NO idea on how to proceed, I have been googling my face off but there is nothing definitive that can show me how to dynamically create forms with it.
Thanx in advance!
Odyss3usOdyss3us2,9011515 gold badges6262 silver badges112112 bronze badges
8 Answers
I think posting a complete solution would be too much, but check out jQuery for this.I give you a hint, jQuery's .append() could be very useful for you :)
Brian J58711 gold badge1818 silver badges3030 bronze badges
yan.kunyan.kun6,17622 gold badges2424 silver badges3636 bronze badges
You could try something like this:
![Window.optimizepress is undefined code Window.optimizepress is undefined code](/uploads/1/2/5/8/125826960/540122291.png)
The HTML part:
![Error Error](/uploads/1/2/5/8/125826960/872721908.jpg)
The javascript:
This way you can create as many elements as you want dynamically.
user1451533user1451533
Yes, you can create any amount of html including forms by running javascript,
Perhaps:`
Our javascript might look like:
IanNortonIanNorton5,87211 gold badge1818 silver badges2525 bronze badges
My idea is that you can use the dform jquery plugin from github to create forms directly by giving input as json data.
Ganesh BabuGanesh Babu1,94888 gold badges2727 silver badges5757 bronze badges
use document.write or if you want more flexibility use jquery
zaynyatyizaynyatyi
Just use the standard DOM API (
Aaron DigullaAaron Digulladocument.createElement()
, see these docs for an example) to create all the elements of the form.254k8888 gold badges489489 silver badges713713 bronze badges
My recommendation would be to get the underscore.js library and use its
Sean VieiraSean Vieiratemplate
function to create your forms. (If underscore is too large for you, the template function can stand on its own too).119k2525 gold badges238238 silver badges238238 bronze badges
TRY THIS...
that's will create a form with DIV inside it...
MuniRMuniR