This is a migrated thread and some comments may be shown as answers.

Highlight value when value is 0

1 Answer 78 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
M
Top achievements
Rank 1
M asked on 03 Jan 2013, 07:11 PM
Hi,

When the value of a numeric text box is 0, I would like to have the value highlighted (= selected) when clicked.

Any pointers?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 07 Jan 2013, 01:06 PM
Hello,

To achieve that you can hook up to the focus event of the NumericTextBox element. Please check the following example:
var numeric = $("#numeric").kendoNumericTextBox()
    .data("kendoNumericTextBox")
    .element
    .bind("focus", function(e) {
        if(this.value === "0") {
            var element = this;
 
            setTimeout(function() {
                $(element).select(); //select the text
            });
        }
    });

Here is a working jsBin sample: http://jsbin.com/adogil/2/edit

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
NumericTextBox
Asked by
M
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or