Skip to content
This repository was archived by the owner on Sep 10, 2023. It is now read-only.

no panel for hint on focus #755

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -746,5 +746,32 @@ <h2>Exclude Current Tokens From Autocomplete</h2>
</script>
</div>


<h2>Do not show hint on focus</h2>
<div>
<input type="text" id="demo-hide-hint" name="lala" />
<input type="button" value="Submit" />
<script type="text/javascript">
$(document).ready(function() {
$("#demo-hide-hint").tokenInput([
{id: 7, name: "Ruby"},
{id: 11, name: "Python"},
{id: 13, name: "JavaScript"},
{id: 17, name: "ActionScript"},
{id: 19, name: "Scheme"},
{id: 23, name: "Lisp"},
{id: 29, name: "C#"},
{id: 31, name: "Fortran"},
{id: 37, name: "Visual Basic"},
{id: 41, name: "C"},
{id: 43, name: "C++"},
{id: 47, name: "Java"}
], {
displayHint: false
});
});
</script>
</div>

</body>
</html>
5 changes: 4 additions & 1 deletion src/jquery.tokeninput.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
theme: null,
zindex: 999,
resultsLimit: null,
displayHint: true,

enableHTML: false,

Expand Down Expand Up @@ -258,7 +259,9 @@
return false;
} else
if ($(input).data("settings").tokenLimit === null || $(input).data("settings").tokenLimit !== token_count) {
show_dropdown_hint();
if (settings.displayHint) {
show_dropdown_hint();
}
}
token_list.addClass($(input).data("settings").classes.focused);
})
Expand Down