I added a div with id='div1'
because you try to prepend to undefined
div
.
Also styled your div with color:white
so that you can see the text:
<h1>Comments</h1>
<textarea id='type'></textarea>
<br />
<br />
<button id='b' >Submit</button>
<div id='div1'></div>
And css :
#div1 {
color:white;
}
jQuery code :
$(document).ready(function () {
$('#b').click(function(){
var v = $('#type').val();
$("#div1").prepend(v);
});
});