jQuery UI Buttonset() 没有按预期响应?
我是 jQuery UI 插件的新手,我正在构建一个演示应用程序来测试我的知识。我正在使用 单选按钮 插件,但我似乎无法获取它在职的。我在 body
加载时调用的函数中有以下行:
$("#buttonSetDiv").buttonset();
我还正确包含了 CSS 和 JS,如下所示:
<style src="jquery-ui-1.8.4.custom/css/ui-darkness/jquery-ui-1.8.4.custom.css"></style>
<script type="text/javascript" src="jquery-1.4.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.4.custom/js/jquery-ui-1.8.4.custom.min.js"></script>
... 实际的 HTML 如下所示:
<form name="radios" id="myForm">
<div id="buttonSetDiv">
<input type="radio" name="group1" value="posts" id="radio1" checked onchange="valueChanged()"> <label for="radio1">Posts</label>
<input type="radio" name="group1" value="members" onchange="valueChanged()" id="radio2">
<label for="radio2">Members</label>
</div>
</form>
... 但是出于某种原因,通过这个看似正确的实现,我仍然得到看起来正常的单选按钮。我想实现这种效果:
这里有人有答案吗?提前非常感谢。 :)
I'm a newbie to the jQuery UI plugin and I'm building a demo application to test my knowledge. I'm using the radio button add-on and I can't seem to get it working. I have the following line in a function called when the body
loads:
$("#buttonSetDiv").buttonset();
I'm also including the CSS and JS correctly, like so:
<style src="jquery-ui-1.8.4.custom/css/ui-darkness/jquery-ui-1.8.4.custom.css"></style>
<script type="text/javascript" src="jquery-1.4.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.4.custom/js/jquery-ui-1.8.4.custom.min.js"></script>
... and the actual HTML looks like this:
<form name="radios" id="myForm">
<div id="buttonSetDiv">
<input type="radio" name="group1" value="posts" id="radio1" checked onchange="valueChanged()"> <label for="radio1">Posts</label>
<input type="radio" name="group1" value="members" onchange="valueChanged()" id="radio2">
<label for="radio2">Members</label>
</div>
</form>
... but for some reason, with this seemingly correct implementation, I'm still getting normal-looking radio buttons. I'd like to achieve this effect:
Does anyone have an answer here? Thanks a ton in advance. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的
缺少
id="radio2"
上的结束引号,因此:应该是:
这至少会导致 Chrome 无法正确识别它, 您可以在此处尝试修复版本。
Your
<input>
is missing a closing quote on theid="radio2"
, so this:Should be:
This is throwing off at least Chrome in recognizing it correctly, you can try the fixed version here.