I have a page that inputs values of textareas into a mysql database. Since this is a pseudo-submit I manually change the value of the textarea to nothing after the data is inputted. however, after i press submit, the data is inputted properly, but the textarea does not clear. the html (below) is echoed several times depending on the number of answers.
Jquery:
<script type='text/javascript'>
$('document').ready(function(){
$('.commentContainer').load('../writecomment.php');
$("form").on("submit", function (e) {
e.preventDefault();
var $form = $(this);
$.ajax({
"url": $form.attr("action"),
"data": $form.serialize(),
"type": $form.attr("method"),
"response": function() {
$('.commentContainer').load('../writecomment.php');
$('.commentBox').val(""); //this line doenst work
}
});
});
});
</script>
HTML:
<textarea class='commentBox' wrap='soft' name='comment'></textarea>
<input type='submit' value='comment' class='submitCommentBox'>
ajaxcode in the accepted answer of your previous question?$('.commentBox').text("");?