JQuery用户界面对象按钮栏,就像单选按钮 [英] JQuery UI object button bar that works like radio buttons

查看:105
本文介绍了JQuery用户界面对象按钮栏,就像单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想作一个控制或使用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.

的标记看起来像这样(直接从演示),只需使用就像一个容器中的< D​​IV>

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用户界面对象按钮栏,就像单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆