lundi 4 mai 2015

How can get custom attribute value in meteor?

How can get the value of "key" attribute which is checked???

Html Code:

<input type="checkbox" class="each-tab-1" key="some1" value="456">
<input type="checkbox" class="each-tab-1" key="some1" value="789">
<input type="checkbox" class="each-tab-1" key="some2" value="890">
<input type="checkbox" class="each-tab-1" key="some2" value="901">
<input type="checkbox" class="each-tab-1" key="some1" value="012">

JS code:

'click .action' : function(event, template){
    $("input[class^=each]:checked").each(function(){
        console.log(this.value);
        console.log(this.attr('key')); **// giving error "Uncaught TypeError: undefined is not a function"**
    });
}




Aucun commentaire:

Enregistrer un commentaire