I have a page containing a collection of Kendo NumericTextboxes. You can access a specific Kendo NumericTextbox using
$("#idOfTheTextbox").data("kendoNumericTextBox")
My problem is that I want to get the collection of Kendo NumericTextboxes so that I can iterate over them using jquery. I want to do this so that I can programatically set the values of each NumericTextbox.
Here is the generated HTML for the NumericTextbox
<span class="k-widget k-numerictextbox"><span class="k-numeric-wrap k-state-default"><input tabindex="0" class="k-formatted-value k-input" aria-disabled="false" aria-readonly="false" style="display: inline-block;" type="text"><input name="PolicySectionSummary.RiskSectionLimitValue" class="k-input" id="txtLimit" role="spinbutton" aria-disabled="false" aria-readonly="false" aria-valuenow="100000" aria-valuemin="0" aria-valuemax="99999999" style="display: none;" type="text" min="0" max="99999999" value="100000,00" data-val="true" data-role="numerictextbox" data-val-number="The field RiskSectionLimitValue must be a number."><span class="k-select"><span class="k-link" style="-ms-touch-action: double-tap-zoom pinch-zoom;" unselectable="on"><span title="Increase value" class="k-icon k-i-arrow-n" unselectable="on">Increase value</span></span><span class="k-link" style="-ms-touch-action: double-tap-zoom pinch-zoom;" unselectable="on"><span title="Decrease value" class="k-icon k-i-arrow-s" unselectable="on">Decrease value</span></span></span></span></span><script>
jQuery(function(){jQuery("#txtLimit").kendoNumericTextBox({"decimals":2});});
You can use the
data-role
attribute to filter all the kendo numeric text boxes (they all havedata-role="numerictextbox"
on the actual input, then apply your code in an each() callJSFiddle here: http://jsfiddle.net/TrueBlueAussie/x6kKK
using sample HTML provided