0
如何獲得被檢查的「key」屬性的值?如何獲取流星中的自定義屬性值?
HTML代碼:
<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代碼:
'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"**
});
}
做到了回答你的問題?如果是這樣,請標記爲已解決。 – ItayB