像单选按钮一样工作的 JQuery UI 对象按钮栏 [英] JQuery UI object button bar that works like radio buttons
本文介绍了像单选按钮一样工作的 JQuery UI 对象按钮栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 jQuery 中制作一个控件或使用一个控件,该控件的作用类似于一系列单选按钮,但看起来像实心按钮而不是单选圆圈.它们看起来像一个水平菜单,但一次只能选择一个.
I'd like to make a control or use a control in jQuery that acts like a series of radio buttons but that looks like solid buttons instead of the radio circle. They'd look like a horizontal menu but only one could be selected at one time.
推荐答案
jQuery UI 在 1.8 中为此添加了一个小部件,请查看 jQuery UI 按钮.
jQuery UI added a widget for this in 1.8, check out jQuery UI Buttons.
标记看起来像这样(直接来自演示),只需使用像 <div>
这样的容器:
The markup looks like this (straight from the demo), just use a container like a <div>
:
<div id="radio">
<input type="radio" id="radio1" name="radio" /><label for="radio1">Choice 1</label>
<input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">Choice 2</label>
<input type="radio" id="radio3" name="radio" /><label for="radio3">Choice 3</label>
</div>
然后调用.buttonset()
:
$("#radio").buttonset();
这篇关于像单选按钮一样工作的 JQuery UI 对象按钮栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文