单选框,获取检查值[iCheck] [英] Radio box, get the checked value [iCheck]
问题描述
基本广播框
<div class="adv_filter">
<li>
<input type="radio" name="letter_type" data-custom="Text" value="0"> Text</li>
</li>
<li>
<input type="radio" name="letter_type" data-custom="Text" value="0"> Text</li>
</li>
</div>
iCheck转换
<!-- iCheck output format
<div class="adv_filter">
<li>
<div class="iradio_square-orange checked" aria-checked="true" aria-disabled="false" style="position: relative;"><input type="radio" name="letter_type" data-custom="Text" value="0" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"></ins></div> Text</li>
<li>
<div class="iradio_square-orange" aria-checked="false" aria-disabled="false" style="position: relative;"><input type="radio" name="letter_type" data-custom="Text" value="0" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"></ins></div> Text</li>
</div> -->
如您所见,选中的内容已附加到div.
$(document).ready(function () {
$('input').iCheck({
checkboxClass: 'icheckbox_square-orange',
radioClass: 'iradio_square-orange',
increaseArea: '20%' // optional
});
$("li").on("click", "input", function () {
var val = $(this).val();
//updateDataGrid(val);
alert(val);
});
});
问题和描述
提供的javascript代码在添加icheck插件之前可以正常工作,
我想知道如何在icheck插件中获得相同的结果.只需简单地在单选按钮上单击即可将值存储在变量中,然后将其进一步传递给函数.
实时示例: http://jsfiddle.net/9ypwjvt4/ iCheck: http://fronteed.com/iCheck/ 将处理程序附加到 有 11种监听更改的方法: Basic radio box iCheck transformation As you see the checked is attached to the div.. Question and description Provided javascript code worked properly before adding the icheck plugin,
I am wondering how to get the same result in the icheck plugin. Its simple, on radio click it stores the value in variable later its passed further to functions. Live example : http://jsfiddle.net/9ypwjvt4/ iCheck : http://fronteed.com/iCheck/ Attach a handler to There are 11 ways to listen for changes: 这篇关于单选框,获取检查值[iCheck]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!ifChanged
事件:$('input').on('ifChecked', function(event){
alert($(this).val()); // alert value
});
ifClicked
-用户单击了自定义输入或分配的标签ifChanged
-输入的检查,禁用或不确定状态已更改ifChecked
-输入的状态已更改为选中状态ifUnchecked
-检查状态已删除ifToggled
-输入的检查状态已更改ifDisabled
-输入的状态已更改为禁用ifEnabled
-禁用状态已删除ifIndeterminate
-输入的状态更改为不确定ifDeterminate
-不确定状态已删除ifCreatedinput
-只是自定义ifDestroyed
-定制已删除<div class="adv_filter">
<li>
<input type="radio" name="letter_type" data-custom="Text" value="0"> Text</li>
</li>
<li>
<input type="radio" name="letter_type" data-custom="Text" value="0"> Text</li>
</li>
</div>
<!-- iCheck output format
<div class="adv_filter">
<li>
<div class="iradio_square-orange checked" aria-checked="true" aria-disabled="false" style="position: relative;"><input type="radio" name="letter_type" data-custom="Text" value="0" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"></ins></div> Text</li>
<li>
<div class="iradio_square-orange" aria-checked="false" aria-disabled="false" style="position: relative;"><input type="radio" name="letter_type" data-custom="Text" value="0" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"></ins></div> Text</li>
</div> -->
$(document).ready(function () {
$('input').iCheck({
checkboxClass: 'icheckbox_square-orange',
radioClass: 'iradio_square-orange',
increaseArea: '20%' // optional
});
$("li").on("click", "input", function () {
var val = $(this).val();
//updateDataGrid(val);
alert(val);
});
});
ifChanged
event:$('input').on('ifChecked', function(event){
alert($(this).val()); // alert value
});
ifClicked
- user clicked on a customized input or an assigned labelifChanged
- input's checked, disabled or indeterminate state is changedifChecked
- input's state is changed to checkedifUnchecked
- checked state is removedifToggled
- input's checked state is changedifDisabled
-input's state is changed to disabledifEnabled
- disabled state is removedifIndeterminate
- input's state is changed to indeterminateifDeterminate
- indeterminate state is removedifCreatedinput
- is just customizedifDestroyed
- customization is just removed