Focus Widget on Label Click
The following example demonstrates how to focus the NumericTextBox when the label
element is clicked.
<label for="numerictextbox">Number: </label>
<input id="numerictextbox" />
<script>
$(function() {
$("#numerictextbox").kendoNumericTextBox();
//global click handler for all label elements
$("label").click(function(e) {
var label = $(this);
var id = label.attr("for");
var widget;
if (id) {
widget = kendo.widgetInstance($("#" + id), kendo.ui);
if (widget) {
e.preventDefault();
widget.focus();
}
}
});
});
</script>
See Also
- NumericTextBox JavaScript API Reference
- How to Change Text Color
- How to Persist Old Value
- How to Select All Text on Focus
- How to Use Custom Culture Script
For more runnable examples on the Kendo UI NumericTextBox, browse its How To documentation folder.