我有以下代码:
WKWebView
如果检查其中任何一个,我如何通过WKWebView.scrollView
获取值?
答案 0 :(得分:0)
试试这个。
function submit() {
var value = [];
$.each($("input[name='data[]']"), function(){
value.push($(this).val());
});
alert("value: " + value.join(", "));
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="checkbox" name="data[]" value="0"><span class="check">
<input type="checkbox" name="data[]" value="1" ><span class="check">
<input type="submit" id="submit" onclick="submit()">
答案 1 :(得分:0)
$(document).ready(function(){
$("input[type=checkbox]").click(function(e){
if(this.checked){
console.log(this.value+" is checked");
}else{
console.log(this.value+" is un-checked");
}
})
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<input type="checkbox" name="data[]" value="0"><span class="check">
<input type="checkbox" name="data[]" value="1" ><span class="check">