Santhosh
Santhosh

Reputation: 901

Dojo Combobox using class attribute

I am trying to implement dojo combobox. It works fine with "id" attribute in ". I am wondering like is their is anyway I can implement using "class" attribute. I have tried it but it is not working for me. It would be great if anyone can help me with this.

here is the code in <div id="stateSelect"> http://jsfiddle.net/RS2Z5/234/

Thanks

Upvotes: 0

Views: 52

Answers (1)

Dhiraj
Dhiraj

Reputation: 33618

Use the dojo/query module to select elements with a certain class. Then iterate over the nodes with that class. Something like this

require(['dojo/query', 'dojo/data/Item...'.....],
  function(query, ItemFile......){
       query(".myselect").forEach(function (node) {
        var comboBox = new ComboBox({
            name: "stateSelect",
            value: "select",
            store: store,
        }, node);
    });
});

Here is a demo http://jsfiddle.net/dhirajbodicherla/RS2Z5/237/

Upvotes: 2

Related Questions