In Onselect event I have script:
$(\"#vinanghinguyen_images_bbocde\").val(\'\');
$(\"#vinanghinguyen_images_bbocde\").val(vinanghinguyen_final_bbcode);
This works:
$('#textareaName').val('');
try this
$("#vinanghinguyen_images_bbocde").attr("value", "");
Use $('textarea').val('')
.
The problem with using
$('textarea').text('')
, or
$('textarea').html('')
for that matter is that it will only erase what was in the original DOM sent by the server. If a user clears it and then enters new input, the clear button will no longer work. Using .val('')
handles the user input case properly.
Rather simpler method would be by using JavaScript method of innerHTML.
document.getElementById("#id_goes_here").innerHTML = "";
Rather simpler and more effective way.
This method removes not only child (and other descendant) elements, but also any text within the set of matched elements. This is because, according to the DOM specification, any string of text within an element is considered a child node of that element.
$('textarea').empty()
Try this,
$('textarea#textarea_id').val(" ");