gpt4 book ai didi

javascript - 复选框数据绑定(bind)返回两个值?

转载 作者:行者123 更新时间:2023-12-03 04:36:12 25 4
gpt4 key购买 nike

我正在尝试获取 ID 和复选框状态(我将 CSS 作为按钮 CSS Button )

按钮名称以及是否处于事件状态

<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>

按钮工作并显示 true false,我不知道如何获取 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”

关于javascript - 复选框数据绑定(bind)返回两个值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43290183/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com