将输入无线电更改为大型div框

时间:2014-02-01 04:26:25

标签: css css3 input radio-button stylesheet

我正在试图弄清楚如何隐藏单选按钮,而是使用div框,这样用户就可以点击一个大盒子而不是一个小按钮。

这可能吗?

2 个答案:

答案 0 :(得分:0)

jQuery UI提供了可能有效的buttonset功能:

<div id="radio"  align="center" >
<input type="radio" name ="gender" id="male" value="MALE" checked="checked"/><label for="male">MALE</label>
            <input type="radio" name ="gender" id="female" value="FEMALE" /><label for="female">FEMALE</label>
</div> 

和脚本

$(function() {
        $( "#radio" ).buttonset();
    });

Demo

答案 1 :(得分:0)

通过点击将div与单选按钮相关联,然后进行设置。

<div class="radio-wrap"><input type="radio"></div>


$('div.radio-wrap').click(function(e){
  $(this).find('[type=radio]').attr('checked',true);
});

您可以使用css隐藏无线电输入或将其移动到您想要的位置。