I understand this is an easy question but for some reason this just isn\'t working for me. I have a function that is triggered everytime a drop down menu is changed. Here
If you want to have element with visible blank text just do this:
$('#doc_title').html(' ');
If you want to clear the text field, use:
$('#doc_title').val("");
Use jQuery.prototype.val
to get/set field values:
var value = $('#doc_title').val(); // get value
$('#doc_title').val(''); // clear value
$('#[element id]').val(null);
or
$('.[element class]').val(null);
If you are using jQuery, then you can use this:
// var doc_val_check = $('#doc_title').val(); - No need of this!
if ($('#doc_title').val().length > 0) {
$('#doc_title').val("");
}
What you need is:
if ($('#doc_title').val()) {
$('#doc_title').val('');
}