How to use dojo TextBox attr function to get value?

How can I get the Dojo TextBox value?

Doing it;

dijit.byId("textName").getValue(); 

But firbug tells me that getValue () is deprecated! the value of attr ('value') is used!

but I don't know how to use the attr ('value') function

reference

Gough

+6
dojo
source share
3 answers

Starting with Dojo 1.5, you must use the get and set methods to retrieve and set properties. But the attr method works until there is Dojo 2.0.

 var box = dijit.byId('textbox') box.get('value'); box.set('value', 'new value'); 
+11
source share

I did this and his work;

 var titleEdit = dijit.byId('title'); var myValue = title.attr('displayedValue'); 

working!

+1
source share

In 1.2, Dijit switched to a general attribute access scheme. To use the new style and avoid the warning, do this instead:

 dijit.byId("textName").attr("value"); 

The Dijit manual wrote a good blog post on attr that might help.

0
source share

All Articles