如果我在bootstrap中有一个单选按钮组,如下所示:
<div class="btn-group" data-toggle="buttons-radio">
<button class="btn">1</button>
<button class="btn">2</button>
<button class="btn">3</button>
<button class="btn">4</button>
</div>
Run Code Online (Sandbox Code Playgroud)
我怎样才能get/ set所选值?
我想在菜单项中添加单选按钮.
我已经看到一些答案,人们将单选按钮作为菜单项.但我希望我的菜单项具有可以轻松完成的正确单选按钮Winforms.
为了确保我没有得到与其他人相同的答案,这里是菜单项的单选按钮应该是什么样子的图片:

顺便说一下,我正在使用C#,WPF.
我在多行中使用radioButton时遇到问题
这是我的xml
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/radio_one0Id"
android:textSize="13sp"
android:layout_weight="1"
android:onClick="oneRadioButtonClicked"
/>
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="13sp"
android:text="5%"
android:id="@+id/radio_one5Id"
android:layout_weight="1"
android:onClick="oneRadioButtonClicked"
/>
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="10%"
android:textSize="13sp"
android:layout_weight="1"
android:id="@+id/radio_one10Id"
android:onClick="oneRadioButtonClicked"
/>
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="20%"
android:layout_weight="1"
android:textSize="13sp"
android:onClick="oneRadioButtonClicked"
android:id="@+id/radio_one20Id"
/>
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="35%"
android:id="@+id/radio_one35Id"
android:textSize="13sp"
android:onClick="oneRadioButtonClicked"
android:layout_weight="1"
/>
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="50%"
android:textSize="13sp"
android:id="@+id/radio_one50Id"
android:onClick="oneRadioButtonClicked"
android:layout_weight="1"
/>
</RadioGroup>
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="65%"
android:textSize="13sp"
android:id="@+id/radio_one65Id"
android:onClick="oneRadioButtonClicked"
android:layout_weight="1"
/>
<RadioButton …Run Code Online (Sandbox Code Playgroud) 我希望这些无线电输入在屏幕上伸展,而不是一个在另一个之下:
HTML
<input type="radio" name="editList" value="always">Always
<br>
<input type="radio" name="editList" value="never">Never
<br>
<input type="radio" name="editList" value="costChange">Cost Change
Run Code Online (Sandbox Code Playgroud)
CSS
input[type="radio"] {
margin-left:10px;
}
Run Code Online (Sandbox Code Playgroud)
http://jsfiddle.net/clayshannon/8wRT3/13/
我已经开始使用显示属性,谷歌搜索,然后敲打(砰?砰??)寻找答案,但没有找到答案.
在我的页面(jsp)中,我有一个radiobutton组和一个文本框(最初被禁用).
我可以使用下面的代码启用最初禁用的复选框.
$("#DevGroup_OTHER").click(function(){
$("#otherDevText").attr("disabled","");
})
Run Code Online (Sandbox Code Playgroud)
我的问题:
问候
我坚持这个简单的选择任务.我有这个型号:
# id :integer(4) not null, primary key
# category :string(255)
# content :text
class Question < ActiveRecord::Base
has_many :choices, :dependent => :destroy
accepts_nested_attributes_for :choices
end
# id :integer(4) not null, primary key
# content :text
# correct :boolean(1)
# question_id :integer(4)
class Choice < ActiveRecord::Base
belongs_to :question
end
Run Code Online (Sandbox Code Playgroud)
当我创建一个新的问题,我想指定不仅在嵌套形式content的Question,但即使是content3个的Answer对象,并用一个单选按钮哪一个是选择correct答案.在new控制器的动作中,我有这个:
def new
@title = "New Question"
@question = Question.new
3.times { @question.choices.build }
respond_to do |format|
format.html # …Run Code Online (Sandbox Code Playgroud) 我想,而不是标准的单选按钮,为每个单选按钮使用不同的图像.对于选定的状态,我希望在图像周围出现边框.
我已经尝试为单选按钮制作图像标签然后隐藏按钮,但这似乎因某种原因而破坏了功能.
我也遇到过这篇文章:http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/我可能会以某种方式扭曲我的目的.
有更简单/更好的方法吗?
只有在检查某个无线电时,我才能以某种方式将所需属性插入输入字段吗?
我有一个名为"梯度计"的输入字段,默认情况下不需要填充.但是,如果用户检查名为"梯形"的单选按钮,则需要填充"梯形仪表"字段.
我的输入如下:
<input type="text" name="ladder-meters" id="ladder-meters">
Run Code Online (Sandbox Code Playgroud)
并且应该在收音机的onchange事件中这样做
<input type="text" name="ladder-meters" id="ladder-meters" required>
Run Code Online (Sandbox Code Playgroud) 我想模仿一组ToggleButtons的样式,如下图所示.任何时候只能"检查"其中一个按钮.

我的问题与样式有关:
我正在使用的当前控件是这样完成的:
<StackPanel Orientation="Horizontal" >
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" Content="All" Padding="12,8,12,8" GroupName="View" />
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" Content="Geolocated" Padding="12,8,12,8" GroupName="View" />
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" Content="Non Geolocated" Padding="12,8,12,8" GroupName="View" />
</StackPanel>
Run Code Online (Sandbox Code Playgroud)
在StackPanel资源中,我试图为ToggleButton设置Style,但我很遗憾如何在上图中获得结果.
我有一组两个单选按钮,其中一个在加载页面时被检查.看来我无法将其改为第二个.如果重要的话,HTML由reactjs构建.chrome上的标记看起来像:
<fieldset data-reactid=".0.0.0.0.0.0.1">
<label for="coop-radio-btn" data-reactid=".0.0.0.0.0.0.1.0">
<span data-reactid=".0.0.0.0.0.0.1.0.0">To a Cooperative</span>
<input type="radio" name="requestOnBehalfOf" value="coop" id="coop-radio-btn" data-reactid=".0.0.0.0.0.0.1.0.1">
</label>
<label for="union-radio-btn" data-reactid=".0.0.0.0.0.0.1.1">
<span data-reactid=".0.0.0.0.0.0.1.1.0">Additional Request</span>
<input type="radio" name="requestOnBehalfOf" value="union" checked="" id="union-radio-btn" data-reactid=".0.0.0.0.0.0.1.1.1">
</label>
</fieldset>
Run Code Online (Sandbox Code Playgroud) radio-button ×10
html ×3
javascript ×3
css ×2
html5 ×2
wpf ×2
android ×1
buttongroup ×1
c# ×1
checkbox ×1
forms ×1
input ×1
jquery ×1
menuitem ×1
nested-forms ×1
onchange ×1
reactjs ×1
required ×1
styles ×1
togglebutton ×1