我正在寻找一个jQuery插件,让我创建一个按钮数组,我发现jQuery UI buttonset 现在这个小部件非常接近我需要的,因为当时只能检查一个按钮,但现在出现了问题:这个小部件是否提供了一种显示特定行数的选项列表(无线电)的方法?我问,因为我想得到如下图所示的结果:
这是fiddle
和Html代码:
<fieldset>
<legend>Operators</legend>
<div id="pare">
<input type="radio" id="pareA" name="pare" value="(" />
<label for="pareA">(</label>
<input type="radio" id="pareC" name="pare" value=")" />
<label for="pareC">)</label>
</div>
<div id="arit">
<input type="radio" id="arit1" name="arit" value="+" />
<label for="arit1">+</label>
<input type="radio" id="arit2" name="arit" value="-" />
<label for="arit2">-</label>
<input type="radio" id="arit3" name="arit" value="*" />
<label for="arit3">*</label>
<input type="radio" id="arit4" name="arit" value="/ " />
<label for="arit4">/</label>
</div>
<div id="rela">
<input type="radio" id="rela2" name="rela" value=">" />
<label for="rela2">></label>
<input type="radio" id="rela5" name="rela" value="<" />
<label for="rela5"><</label>
<input type="radio" id="rela3" name="rela" value=">=" />
<label for="rela3">>=</label>
<input type="radio" id="rela6" name="rela" value="<=" />
<label for="rela6"><=</label>
<input type="radio" id="rela1" name="rela" value="=" />
<label for="rela1"> = </label>
<input type="radio" id="rela4" name="rela" value="<>" />
<label for="rela4"><></label>
</div>
<div id="logi">
<input type="radio" id="logi1" name="logi" value="And" />
<label for="logi1">And</label>
<input type="radio" id="logi2" name="op" value="Or" />
<label for="logi2"> Or</label>
</div>
</fieldset>
和js :
$("#pare").buttonset();
$("#arit").buttonset();
$("#rela").buttonset();
$("#logi").buttonset();
非常感谢任何建议或指导。
答案 0 :(得分:1)
如果我理解你的问题是正确的,你想改变应用css来改变你的html,如图中所述。尝试使用以下命令更新html代码:
<fieldset>
<legend>Operators</legend>
<div class="left">
<div id="pare">
<input type="radio" id="pareA" name="pare" value="(" />
<label for="pareA">(</label>
<input type="radio" id="pareC" name="pare" value=")" />
<label for="pareC">)</label>
</div>
<div id="arit">
<input type="radio" id="arit1" name="arit" value="+" />
<label for="arit1">+</label>
<input type="radio" id="arit2" name="arit" value="-" />
<label for="arit2">-</label>
<input type="radio" id="arit3" name="arit" value="*" />
<label for="arit3">*</label>
<input type="radio" id="arit4" name="arit" value="/ " />
<label for="arit4">/</label>
</div>
</div>
<div class="right">
<div id="rela">
<input type="radio" id="rela2" name="rela" value=">" />
<label for="rela2">></label>
<input type="radio" id="rela5" name="rela" value="<" />
<label for="rela5"><</label>
<input type="radio" id="rela3" name="rela" value=">=" />
<label for="rela3">>=</label>
<input type="radio" id="rela6" name="rela" value="<=" />
<label for="rela6"><=</label>
<input type="radio" id="rela1" name="rela" value="=" />
<label for="rela1"> = </label>
<input type="radio" id="rela4" name="rela" value="<>" />
<label for="rela4"><></label>
</div>
<div id="logi">
<input type="radio" id="logi1" name="logi" value="And" />
<label for="logi1">And</label>
<input type="radio" id="logi2" name="op" value="Or" />
<label for="logi2"> Or</label>
</div>
</div>
</fieldset>
<强> CSS:强>
.left{
float:left;
}
.right{
float:left;
}
#arit{
width:100px;
}
#rela{
width:140px;
}
的 DEMO FIDDLE 强>