JQuery UI 对象按钮栏的工作方式类似于单选按钮

发布于 2024-09-10 23:07:17 字数 86 浏览 2 评论 0原文

我想在 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

粉红×色少女 2024-09-17 23:07:17

jQuery UI 在 1.8 中为此添加了一个小部件,请查看 jQuery UI 按钮

标记看起来像这样(直接来自演示),只需使用像

这样的容器:

<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 added a widget for this in 1.8, check out jQuery UI Buttons.

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>

Then call .buttonset():

$("#radio").buttonset();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文