I’m beginner in DOM javascript, So I have such a question.
I have html form like that =>
<div id="name_field" style="text-align: center;">
<form name="add" action="index.php" method="post">
Name <input type="text" name="name_" id="name_" size="15"> <a href="javascript:void(0)" class="some" onclick="addChild();">Add More</a><br>
<span id="a">here is that</span>
</form>
</div>
And want to call like it is seen addChild() function which will append “input” element in div with style (css) content. I have such a javascript code =>
function addChild()
{
var div = document.getElementById("name_field");
var el = document.createElement("input");
el.style.size = 10;
div.appendChild(el);
}
But it is not working … Also need to append “input” element from above to below and how to do that , if anyone help me. Thanks … 🙂
The
sizeof aninputelement isn’t a style property. It’s a property of theinputelement itself.So this…
should be this…
I just don’t know what you mean by “Also need to append “input” element from above to below…”.