I want to do 2 things as soon as the input-box gets focus:
- autocomplete (default dropdown)
remove the default-value as
$(".keywordbox > input").autocomplete({"source":"/nl/video/show-keywords/3", "maxLength" : "10" }); $(".keywordbox > input").focus(function() { if ($(this).val() == $(this).prop("defaultValue")) { $(this).val(''); } $(this).trigger('keydown.autocomplete'); });
The autocomplete on focus works fine, except when it is combined with
$(this).val('');
Anyone suggestions to make this work?
** EDIT **
Seems that autocomplete does not work because the input is empty. Even when there is no placeholder-value set.
What I want is that de autocomplete sets of without giving a value, so that all options (without filtering) can be given.