+1 vote
4 views
in Javascript by
edited by

How do you create a hidden field in JavaScript into a particular form ?

1 Answer

0 votes
by (870 points)
var input = document.createElement("input");

input.setAttribute("type", "hidden");

input.setAttribute("name", "name_you_want");

input.setAttribute("value", "value_you_want");

//append to form element that you want .
document.getElementById("chells").appendChild(input);

Related questions

0 votes
1 answer 126 views
asked Jun 13, 2016 in Magento by Jelena
+1 vote
0 answers 674 views
0 votes
1 answer 666 views
0 votes
1 answer 4 views
0 votes
0 answers 2.6k views
asked Nov 15, 2017 in Modules by HenryRoger (820 points)
...