This binding selects the text in a input field or a textarea when the field get focused.
JavaScript
Latest commit c830f56 Feb 21, 2014 @sunesimonsen sunesimonsen 0.1.5
Permalink
Failed to load latest commit information.
lib Also apply selection function if the element is already focused on init Feb 21, 2014
LICENSE Added license file Sep 26, 2013
README.md Update README.md Nov 9, 2013
package.json 0.1.5 Feb 21, 2014

README.md

knockout.selectOnFocus

This binding selects the text in a input field or a textarea when the field get focused.

Click here to see an example

Install

NPM

npm install knockout-select-on-focus

Usage

<input type="text" data-bind="selectOnFocus: true">
Selects all text when the element is focused.

<input type="text" data-bind="selectOnFocus: /^[^\.]+/">
Selects all text before the first period when the element is focused.

<input type="text" data-bind="selectOnFocus: { pattern: /^[^\.]+/, onlySelectOnFirstFocus: true }">
Only select the pattern on the first focus.

License

Knockout.selectOnFocus is licensed under a standard 3-clause BSD license -- see the LICENSE-file for details.