dojo 1.8:选择时的值指示器

时间:2013-01-17 09:30:07

标签: dojo

您好我已经设置了dijit / select但问题是我不确定要选择捕获并指示值。我见过dijit / form select,dojo.query和dojo / on。但我仍然无法提出解决方案。你能建议吗?感谢

var select_Card = new Select
(
 {name:'select_PCBA',
  options:
       [
  {label:"<span id='NotinUse'><b>&nbsp&nbsp&nbsp. . .</b></span>", value:"", selected:true},
 {label:"<span id='NotinUse'><b>&nbsp&nbspA Card</b></span>", value:"a" },
 {label:"<span id='inUse'><b>&nbsp&nbspB Card</b></span>", value:"b"},
 {label:"<span id='NotinUse'><b>&nbsp&nbspC Card</b></span>", value:"c"},
 {label:"<span id='NotinUse'><b>&nbsp&nbspD Card</b></span>", value:"d"},
 {label:"<span id='NotinUse'><b>&nbsp&nbspE Card</b></span>", value:"e"},
       ], style:{width:'150px'}
},"select_Card");

    var card = dom.byId('inUse');   
on(card,'click', function(evt)
{
     alert('Item selected is'+ card.value);
    });

克莱门特

1 个答案:

答案 0 :(得分:0)

小部件的onChange事件就是您想要的。

on(select_Card, 'change', function(newValue){
    alert(newValue);
});

http://jsfiddle.net/cswing/udJuv/