You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regarding grabbing the value back out of a typeahead:
The example in the documentation gives you the idea that you can retrieve the value by simply calling .typahead('val') on a jquery object created using the same selector as the selector used to create the typeahead. the example in the docs here: https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md#jquerytypeaheadval
is:
var myVal = $('.typeahead').typeahead('val');
I interpreted this to mean that If I had a particular <input> with the class .typeahead on it, and I did a $('.typeahead').typeahead(... to create a typeahead on it, then the above code would hand me back the value. This isn't the case, because there is the "hint" typeahead that is copied, which doesn't have the value attached to it. You can see my problem illustrated here: http://jsfiddle.net/734x5/
I like the idea of typeahead going through the set of matched jquery elements until it finds one that has a value, and this doesn't seem too dangerous because we should know the structure of the dom nodes the plugin creates.
Modifying the documentation would be the easier choice of course :)
The text was updated successfully, but these errors were encountered:
I like the idea of typeahead going through the set of matched jquery elements until it finds one that has a value, and this doesn't seem too dangerous because we should know the structure of the dom nodes the plugin creates.
I agree, this is how it should work. I'll get this fixed for the next release.
Regarding grabbing the value back out of a typeahead:
The example in the documentation gives you the idea that you can retrieve the value by simply calling
.typahead('val')
on a jquery object created using the same selector as the selector used to create the typeahead. the example in the docs here:https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md#jquerytypeaheadval
is:
I interpreted this to mean that If I had a particular
<input>
with the class.typeahead
on it, and I did a$('.typeahead').typeahead(...
to create a typeahead on it, then the above code would hand me back the value. This isn't the case, because there is the "hint" typeahead that is copied, which doesn't have the value attached to it. You can see my problem illustrated here: http://jsfiddle.net/734x5/I like the idea of typeahead going through the set of matched jquery elements until it finds one that has a value, and this doesn't seem too dangerous because we should know the structure of the dom nodes the plugin creates.
Modifying the documentation would be the easier choice of course :)
The text was updated successfully, but these errors were encountered: