+1 vote
813 views
in Javascript by
edited by

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

1 Answer

0 votes
by (1.3k 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 1.8k views
0 votes
1 answer 1.1k views
asked Jun 13, 2016 in Magento by Jelena
+1 vote
0 answers 1.3k views
0 votes
1 answer 2.0k views
0 votes
0 answers 3.2k views
asked Nov 15, 2017 in Modules by HenryRoger (820 points)
0 votes
1 answer 857 views
...