LP13
LP13

Reputation: 34109

Could find kendoNumericTextBox by class name

I am trying to attach change event handler to the instance of kendoNumercTextBox. I am able to get the instance of kendoNumercTextBox control using its ID, however Im not able to get the instance using class name

here is the code http://dojo.telerik.com/emIWa/11

NOTE

Upvotes: 0

Views: 1069

Answers (1)

NigelK
NigelK

Reputation: 8490

You need to use a more specific jQuery selector. This for example will get the correct element which is the one with the data-role attribute:

var numerictextboxByClassName = $(".MyClass [data-role]")

If you use the developer tools in your browser to inspect the text box, you'll see that 'MyClass' is on several elements that comprise the widget, hence the need to be more specific. It is also worth noting that the handler will only attach to the first instance found using the selector so this method cannot be used to attach a handler to several such controls at the same time.

Upvotes: 1

Related Questions