开发者

Unable to get Dojo Textbox Value in Handler

开发者 https://www.devze.com 2023-01-30 23:59 出处:网络
In the key up handler when i try to access the value 开发者_如何转开发of the textbox i get an empty string back. this is my code.

In the key up handler when i try to access the value 开发者_如何转开发of the textbox i get an empty string back. this is my code.

        dojo.connect(dijit.byId("loginpassword"), "onKeyUp", function(evt){
            if(evt.keyCode==13){
                var value = dijit.byId("loginpassword"); //get a empty string here
            }
        });

When i try the same statement outside the handler it works properly. Am I doing something wrong, or is it a dojo bug?

Update: This was wat i had actually had

var value = dijit.byId("loginpassword").value;


dijit.byId("loginpassword") is going to return a widget Object, not a string (check typeof) Perhaps you want to do something like dijit.byId("loginpassword").attr("value") ?

0

精彩评论

暂无评论...
验证码 换一张
取 消