gath
gath

Reputation: 25472

How do use dojo TextBox attr function to get value?

How can i get the value of a Dojo TextBox?

Am doing this;

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

But firbug tells me getValue() is deprecated! is use attr('value')!

but i have no clue on how to use attr('value') function

Help

Gath

Upvotes: 6

Views: 18860

Answers (3)

gath
gath

Reputation: 25472

I've done this and its working;

var titleEdit = dijit.byId('title');

var myValue = title.attr('displayedValue');

worked!

Upvotes: 1

Ben Lowery
Ben Lowery

Reputation: 344

In 1.2, Dijit moved to a common attribute accessor scheme. To use the new style and avoid the warning do this instead:

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

The lead for Dijit wrote up a good blog post on attr that might help.

Upvotes: 0

David Raab
David Raab

Reputation: 4488

Starting with Dojo 1.5 you should use the get and set methods to fetch and set properties. But the attr method is still working until Dojo 2.0 is out.

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

Upvotes: 11

Related Questions