my code below deletes the text from my textarea that is inserted by a user after clicking the submit button but what i want is i want the text to be in my textarea after submit.
<form action="/search" name="myform" id="formid" method="post" >
<div class="input-group" >
<!--
<textarea name="input" id="textArea" />
<button type="submit" onclick="return fill()" >Search</button>
</button>
</div>
</form>
<script type="text/javascript">
function fill()
{
var x = document.getElementById('textArea').value;
document.getElementById('demo').innerHTML=x;
}
</script>
Simply try to add onSubmit="return false;" at the form tag
<form action="/search" onSubmit="return false;" name="myform" id="formid" method="post" >