Hey There,
I am trying to clear the message text field after displaying message.
Here’s code snippts.
$("#chatText").keyup(function (e) {
if (e.keyCode === 13) {
$chatText = $("#chatText").val();
$.post('../insertchat.php', {'chatText': $chatText}, function (data, status) {
$("#chatText").value("");
if (status === "success") {
$("#chatmessage").load("../displayMessage.php", function (data, status) {
}, 3000);
//here i am trying to clear the fileds but didn't worked for me.
$(body).find('input, textarea').val(" ");
$("#chatText").value(" ");
} else {
// alert("fuuuuuuuuuuuu");
}
});
}
});