Highlight value when value is 0

2 posts, 0 answers
  1. M
    M avatar
    3 posts
    Member since:
    Aug 2012

    Posted 03 Jan 2013 Link to this post


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

    Any pointers?

  2. Alexander Valchev
    Alexander Valchev avatar
    2895 posts

    Posted 07 Jan 2013 Link to this post


    To achieve that you can hook up to the focus event of the NumericTextBox element. Please check the following example:
    var numeric = $("#numeric").kendoNumericTextBox()
        .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!
Back to Top