Typeahead.js: Calling $(element).typeahead('val') returns Undefined

Created on 5 Jun 2014  路  5Comments  路  Source: twitter/typeahead.js

Currently not possible to get the value of typeahead input as the .typeahead('val') reurns Undefined.

console.log($(this).typeahead('val', 'val')); // this works, value is set to 'val'
console.log($(this).typeahead('val')); // returns `Undefined`
bug duplicate

Most helpful comment

always undefined to me too, using $('.typeahead') selector
@thedavidscherer, i ended up using, as a quick-fix, the class .tt-input (following the markup created by the plugin)

$('.tt-input').typeahead('val'); // and works as you'd expect
$('.tt-input').val(); // normal jquery val()

All 5 comments

always undefined to me too, using $('.typeahead') selector
@thedavidscherer, i ended up using, as a quick-fix, the class .tt-input (following the markup created by the plugin)

$('.tt-input').typeahead('val'); // and works as you'd expect
$('.tt-input').val(); // normal jquery val()

I can confirm this issue.

Duplicate of #815 which has been addressed in v0.10.3 (planning on releasing later this week.).

The issue still exist v 0.11.1

@boldt
I'm not able to get value of input using
$('.typahead').typeahead('val');

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jarrodparkes picture jarrodparkes  路  6Comments

digitalpenguin picture digitalpenguin  路  4Comments

DevChive picture DevChive  路  5Comments

Gyanxie picture Gyanxie  路  5Comments

steswinbank picture steswinbank  路  5Comments