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

CurrencyTextBox keypress

1 Answer 7 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Lee
Top achievements
Rank 1
Lee asked on 09 Jan 2013, 05:41 PM
Hi,

I have the following code to catch the user key stroke:


 @(Html.Telerik().CurrencyTextBox()
        .Value(0)
        .Name("txtpercent")
        .HtmlAttributes(new { style = "width:10px" })
        .ClientEvents (e => e.OnLoad("txtpercent_onload()"))
        .EmptyMessage(""))

function txtpercent_onload() {
        
        $($("#txtpercent").data("tEditor").body).bind("keydown", function (e) {
                alert('hi');
    }

Error message:
Microsoft JScript runtime error: Unable to get value of the property 'body': object is null or undefined

I need help on how to solve this issue.  Thanks!

1 Answer, 1 is accepted

Sort by
0
Lee
Top achievements
Rank 1
answered on 10 Jan 2013, 05:33 PM
Problem solved - It should be:

function txtpercent_onload() {
        
        $("#txtpercent").bind("keydown", function (e) {
                alert('hi');
});
    }
Tags
Editor
Asked by
Lee
Top achievements
Rank 1
Answers by
Lee
Top achievements
Rank 1
Share this question
or