我正在尝试获取ID和复选框状态 [英] I am trying to get ID and checkbox status
本文介绍了我正在尝试获取ID和复选框状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试获取ID和复选框状态(我将CSS作为按钮)
按钮名称以及是否处于活动状态/>
I am trying to get ID and checkbox status ( I have CSS as a Button)
Button name and if active
<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>
</div>
<div class="onoffswitch">
<input type="checkbox" data-bind="checked: ioValue" class="onoffswitch-checkbox" id="io3">
<label class="onoffswitch-label" for="io3">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
按钮有效,显示为false,我无法弄清楚如何获取ID
The button works and show true false, I can not work out how to get the 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
});
}
我尝试过:
我试过添加代码,但没有工作($ data,['io1','on'])。
What I have tried:
I have tried adding code none work yet like ($data, ['io1', 'on']).
推荐答案
.ajax({
type: GET,
dataType:< span class =code-string> json,
data:{ io:data [ 0 ], status:data [ 1 ]},
url: / plugin / test / setIOcheckbox,
async: false
});
}
.ajax({ type: "GET", dataType: "json", data: {"io": data[0], "status": data[1]}, url: "/plugin/test/setIOcheckbox", async: false }); }
我尝试过:
我尝试添加无代码的代码(
What I have tried:
I have tried adding code none work yet like (
data,['io1','on'])。
data, ['io1', 'on']).
这篇关于我正在尝试获取ID和复选框状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文