i have spend great time in searching this type of problem but found no suitable answer. what i am trying is to get text name <input type='text' name="qname"> from java script and send in html form. is there is a possibilty? my stress is on this part.
code:
<html>
<!-- skipped part-->
<script type="text/javascript" defer="defer">
function create()
{
var newDiv = document.createElement('div');
var divId = "someId";
newDiv.id = divId;
var output = "<table id='e' border><tr><td><input type='text' name="qname"></td><td><input type='text1' name="qty"></td><td><input type='text' name="price"></td><button onclick=del('"+ divId +"')>delete</button></td></tr></table>";
newDiv.innerHTML = output;
newDiv.className = 'newClass';
document.body.appendChild(newDiv);
}
function del (id) {
var div = document.getElementById(id);
div.parentNode.removeChild(div);
}
</script>
<body>
<form method="post" action="transaction.php" onclick="create()">
<button onclick="create()">create</button>
<input type="submit" value="submit" />
</form>
</body>
var output = "<table ..."I would suggest single quotes around the entire string (except where concatenation is performed) and double quotes for each of the HTML properties.name=\"qname\". 2) You need to append to the form, not the body, if you want it to post:document.getElementsByTagName("form")[0].appendChild(newDiv);