0

我正在制作一个应用程序,jQuery.icheck在单击某个 div 时使用显示单选按钮,我想在检查其中一个按钮时采取某种操作,我正在使用 icheck 网站中列出的说明,但我没有得到任何代码正在使用:

var itemoptions=[],optionstring='', oi=0;

for(oi=0;oi<=oc-1;oi++) {
  itemoptions[oi]=$('menu').find($(".selected").text()).children().eq(si).children().eq(oi).prop('nodeName');
  optionstring=optionstring+'<input type="radio" name="iCheck"><p style="line-height:10px; font-size:15px;">'+(itemoptions[oi]).toString()+'</p>'
}

$('.item_block').on('click',function(){
$('input').iCheck('check');    // here's the line of code that is supposed to be used to check all of he icheck radio buttons 
$(this).addClass('flipped_item');
  $(this).flip({                              //flipping options
  direction:'lr',
  speed:250,
  content:"<div class='option_wrapper'>"+optionstring+"</div>",
  onEnd:function(){$('input').iCheck({
    checkboxClass: 'icheckbox_flat-yellow',
    radioClass: 'iradio_flat-yellow'
  });
})
4

2 回答 2

0

利用

document.getElementById("check1").checked=true

陈述

于 2013-09-20T20:58:40.447 回答
0

如果我理解正确,并且您只是想在选中或取消选中该单选按钮时执行一个操作,则可以将其绑定到更改事件。

$(this).flip({                         //flipping options
    direction:  'lr',
    speed:      250,
    content:    "<div class='option_wrapper'>"+optionstring+"</div>",
    onEnd:      function() {
                    $('input').iCheck({
                        checkboxClass: 'icheckbox_flat-yellow',
                        radioClass: 'iradio_flat-yellow'
                    });
                    $('input').change(function() {
                        if ($(this).is(':checked'))
                            // Do Stuff
                        else
                            // Do other stuff
                    });
                }
});
于 2013-09-20T21:04:21.897 回答