簡體   English   中英

復選框數據綁定返回兩個值?

[英]Checkbox data-bind return two values?

我正在嘗試獲取ID和復選框狀態(我將CSS作為Button 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,我無法確定如何獲取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”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM