By default, JavaScript reset is called after your .click() function, which returns the default asf value.
If you want to avoid using the default reset functionality, use jQuery event.preventDefault() or just add return false; at the end of your function. for instance
$('#dirreset').click(function() { $('#keywordsearch').val(''); return false; });
Alternatively, change the <input> type to "button" , which will not have the default reset functionality executed after your function. However, you may need to do extra work if you want to simulate a reset.
source share