Skip to content

Commit

Permalink
Added val methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Basarat Syed committed Jul 21, 2014
1 parent 14c95ef commit 735c0f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions typeahead/typeahead-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ $('.example-countries .typeahead').typeahead({
prefetch: '../data/countries.json',
limit: 10
});

module valueTest {
var value: string = $('foo').typeahead('val');
$('foo').typeahead('val', value);
}
11 changes: 11 additions & 0 deletions typeahead/typeahead.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ interface JQuery {
* @param dataset Array of datasets
*/
typeahead(options: Twitter.Typeahead.Options, dataset: Twitter.Typeahead.Dataset): JQuery;

/**
* Returns the current value of the typeahead. The value is the text the user has entered into the input element.
*/
typeahead(methodName: 'val'): string;
typeahead(methodName: string): string;

/**
* Sets the value of the typeahead. This should be used in place of jQuery#val.
*/
typeahead(methodName: 'val', value: string): JQuery;
}

declare module Twitter.Typeahead {
Expand Down

0 comments on commit 735c0f1

Please sign in to comment.