question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calling $(element).typeahead('val') returns Undefined

See original GitHub issue

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`

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Baso1stcommented, Jun 7, 2017

The issue still exist v 0.11.1

2reactions
razzettocommented, Jun 10, 2014

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()
Read more comments on GitHub >

github_iconTop Results From Across the Web

typeahead.js get input value on button click - Stack Overflow
I am having problems as the $('.typeahead').typeahead('val') method doesn't seem to be working at all (error: undefined). trying $('.typeahead') ...
Read more >
Javascript – Twitter Bootstrap typeahead: get context / calling ...
I am trying to access the text box element from within typeahead's updater function. Here is my current code, which works great:
Read more >
typeahead this.$element.val(...).text is not a function - jQWidgets
I am using the EditDialog in the Scheduler. When the dialog is created: var SaleEnquiryRefField = “<div>”;
Read more >
jQuery Typeahead Search Configuration - RunningCoder
Call the $.typeahead() function with the input option configured ... null , // Set the input value template when an item is clicked...
Read more >
jquery typeahead - Christopher Baines
jQuery#typeahead('val'). Returns the current value of the typeahead. The value is the text the user has entered into the input element.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found