标签: radio-button

如何获取twitter bootstrap按钮组中所选按钮的值

如果我在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所选值?

javascript radio-button buttongroup twitter-bootstrap

14
推荐指数
3
解决办法
3万
查看次数

如何为菜单项添加单选按钮?

我想在菜单项中添加单选按钮.

我已经看到一些答案,人们将单选按钮作为菜单项.但我希望我的菜单项具有可以轻松完成的正确单选按钮Winforms.

为了确保我没有得到与其他人相同的答案,这里是菜单项的单选按钮应该是什么样子的图片:

在此输入图像描述

顺便说一下,我正在使用C#,WPF.

c# wpf menuitem radio-button

14
推荐指数
1
解决办法
7667
查看次数

android中的多行单选按钮?

我在多行中使用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)

android radio-button

14
推荐指数
4
解决办法
3万
查看次数

如何让输入无线电元素水平对齐?

我希望这些无线电输入在屏幕上伸展,而不是一个在另一个之下:

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/

我已经开始使用显示属性,谷歌搜索,然后敲打(砰?砰??)寻找答案,但没有找到答案.

html css input radio-button

14
推荐指数
2
解决办法
8万
查看次数

jquery启用/禁用基于radiobutton的文本框

在我的页面(jsp)中,我有一个radiobutton组和一个文本框(最初被禁用).

  • 每当用户点击单选按钮时,应启用文本框
  • 当用户点击其他一些单选按钮时,文本框应再次被禁用.

我可以使用下面的代码启用最初禁用的复选框.

$("#DevGroup_OTHER").click(function(){          
    $("#otherDevText").attr("disabled","");
})
Run Code Online (Sandbox Code Playgroud)

我的问题:

  • 但是我怎么能再次禁用文本框?
  • 使用jQuery有更简单的解决方案吗?

问候

checkbox jquery radio-button

13
推荐指数
2
解决办法
10万
查看次数

Rails:嵌套对象的单选按钮选择

我坚持这个简单的选择任务.我有这个型号:

#  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)

当我创建一个新的问题,我想指定不仅在嵌套形式contentQuestion,但即使是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)

nested-forms radio-button nested-attributes ruby-on-rails-3

13
推荐指数
3
解决办法
4779
查看次数

如何用图像替换替换单选按钮?

我想,而不是标准的单选按钮,为每个单选按钮使用不同的图像.对于选定的状态,我希望在图像周围出现边框.

我已经尝试为单选按钮制作图像标签然后隐藏按钮,但这似乎因某种原因而破坏了功能.

我也遇到过这篇文章:http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/我可能会以某种方式扭曲我的目的.

有更简单/更好的方法吗?

html css forms radio-button

13
推荐指数
3
解决办法
7万
查看次数

如果选中无线电,则需要输入字段

只有在检查某个无线电时,我才能以某种方式将所需属性插入输入字段吗?

我有一个名为"梯度计"的输入字段,默认情况下不需要填充.但是,如果用户检查名为"梯形"的单选按钮,则需要填充"梯形仪表"字段.

我的输入如下:

<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)

javascript html5 onchange radio-button required

13
推荐指数
3
解决办法
3万
查看次数

WPF RadioButton/ToggleButton样式

我想模仿一组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,但我很遗憾如何在上图中获得结果.

wpf styles radio-button togglebutton

13
推荐指数
1
解决办法
2万
查看次数

HTML + React:单选按钮卡在最初设置为"已检查"的按钮上

我有一组两个单选按钮,其中一个在加载页面时被检查.看来我无法将其改为第二个.如果重要的话,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)

html javascript html5 radio-button reactjs

13
推荐指数
3
解决办法
2万
查看次数