0

嗨,我已经设置了 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);
    });

克莱门特

4

1 回答 1

0

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

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

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

于 2013-01-17T12:47:37.947 回答