我正在尝试获取ID和复选框状态(我有CSS作为按钮CSS按钮(
按钮名称以及是否处于活动状态
<div class="onoffswitch">
<input type="checkbox" data-bind="checked: ioValue" class="onoffswitch-checkbox" id="io1">
<label class="onoffswitch-label" for="io1">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
按钮工作并显示真假,我无法弄清楚如何获取ID
self.ioEvent = function(data, event) {
console.log(1)
console.log(data)
console.log(data[0])
console.log(data[1])
$.ajax({
type: "GET",
dataType: "json",
data: {"io": data[0], "status": data[1]},
url: "/plugin/test/setIOcheckbox",
async: false
});
}
event.target.id 应该给你"ID">