标签: checkbox

定制设计复选框按钮

我试图自定义设计复选框按钮,使它们看起来不像典型的复选框按钮.我试图实现以下目标:

在此输入图像描述

(注意检查交叉标记是图像.)

到目前为止,我已经能够实现这一目标:

在此输入图像描述

但我似乎无法摆脱勾选出现的小白色复选框.我想在选择时更改复选框按钮的CSS.例如,是,检查边框变为绿色,否则保持灰色.

有可能吗?

编辑:

.btn-primary {
  background-color: #f6f9fc;
  border: 1px solid Rgba(61, 70, 77, 0.1);
  font-size: 11px;
  color: #3d464d;
  width: 200px;
  height: 200px;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />

<label class="btn btn-primary">
  <input type="checkbox" value="yes">yes
</label>

<label class="btn btn-primary">
  <input type="checkbox" value="no">no
</label>
Run Code Online (Sandbox Code Playgroud)

html css checkbox html5 css3

0
推荐指数
1
解决办法
109
查看次数

单击标签不会检查我的输入字段

我正在使用以下代码.复选框不希望用我给它的样式进行检查.

 <div class="form-group">
    <div class="col-md-6 col-md-offset-4">
       <div class="checkbox">
          <input name="remember" type="checkbox" ><label>Wachtwoord onthouden</label>
       </div>
    </div>
 </div>'
Run Code Online (Sandbox Code Playgroud)

和css:

col-md-4.control-label, #email, #password {
    margin: 20px auto;
    width: 300px;
    resize: none;
    font-family: 'Exo 2', sans-serif;
    font-size: 1em;
    outline: none;

}

.btn.btn-link, .checkbox {
    display: block;
    margin-top:20px;
    margin-bottom:20px;
    color: $white;
}

[type="checkbox"]:not(:checked),
[type="checkbox"]:checked {
    position: absolute;
    left: -9999px;
}
[type="checkbox"]:not(:checked) + label,
[type="checkbox"]:checked + label {
    position: relative;
    padding-left: 25px;
    cursor: pointer;
}

/* checkbox aspect */
[type="checkbox"]:not(:checked) + label:before,
[type="checkbox"]:checked + label:before { …
Run Code Online (Sandbox Code Playgroud)

html css checkbox

0
推荐指数
1
解决办法
721
查看次数

iTextSharp复选框具有值,但未显示为已选中

我需要使用iTextSharp编辑PDF文件。我有一个单选按钮和复选框,如下所述。

我想要以下内容:如果我在单选按钮上打了一个勾号,则该复选框必须显示为选中状态。

在代码中,单选按钮具有一个值,但是当我第一次打开PDF文件时,未选中该复选框。

当我再次在单选按钮中放置一个复选标记时,它变为可见。

这是我的代码;

PdfReader pdfReader = new PdfReader(pdfTemplate);
PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(newFile, FileMode.OpenOrCreate)); 
AcroFields pdfFormFields = pdfStamper.AcroFields;
pdfFormFields.SetField("4a.0", "1"); // radio button
pdfFormFields.SetField("4a.1", "1"); // checkbox
pdfFormFields.SetField("4a.2", "2010"); // text box 
Run Code Online (Sandbox Code Playgroud)

c# pdf checkbox itext

0
推荐指数
1
解决办法
815
查看次数

Woocommerce优惠券添加自定义复选框

我对functions.php中的这个简单功能已经足够了解,让我为优惠券添加一个复选框。但是,一旦我保存/更新了优惠券,我的复选框值(已选中/未选中)就不会提交(因此该复选框始终处于未选中状态)。换句话说,当我更新/保存时,无法在postmetas的meta_value列中将其更新为yes。复选框在那里,我就是无法使用...非常沮丧!关于我做错的任何建议,请:)

function add_coupon_revenue_dropdown_checkbox() { 
$post_id = $_GET['post'];

woocommerce_wp_checkbox( array( 'id' => 'include_stats', 'label' => __( 'Coupon check list', 'woocommerce' ), 'description' => sprintf( __( 'Includes the coupon in coupon check drop-down list', 'woocommerce' ) ) ) );

$include_stats = isset( $_POST['include_stats'] ) ? 'yes' : 'no';

update_post_meta( $post_id, 'include_stats', $include_stats );

do_action( 'woocommerce_coupon_options_save', $post_id );

}add_action( 'woocommerce_coupon_options', 'add_coupon_revenue_dropdown_checkbox', 10, 0 ); 
Run Code Online (Sandbox Code Playgroud)

我要影响的部分是:

wp-content / plugins / woocommerce / includes / admin / meta-boxes / class-wc-meta-box-coupon-data.php

php wordpress checkbox woocommerce hook-woocommerce

0
推荐指数
1
解决办法
1193
查看次数

通过循环创建复选框时,仅显示第一个复选框

我有一个用户定义的"标签"列表,存储在名为warehouse.tags的字符串列表中.使用基本的for循环,我为每个标签创建复选框,并将它们添加到Windows窗体中的面板.

问题是只显示第一个复选框.我多次遍历代码,位置坐标和其他属性似乎正在工作.问题似乎不是复选框位置在面板边界之外.

   for(int i = 0; i < warehouse.tags.Count; i++) //adds check boxes for each tag
        {
            CheckBox tagNameLabel = new CheckBox();
            tagNameLabel.Text = warehouse.tags.ElementAt(i);
            Point tagLabelPoint = new Point();
            tagLabelPoint.X = xAdjuster; // xadjuster = 25 in this case 
            tagLabelPoint.Y = (5 + yAdjuster) * (warehouse.categories.Count + 1); //yadjuster = 25 as well
            tagNameLabel.Location = tagLabelPoint;
            this.filterOptionsPanel.Controls.Add(tagNameLabel);

        }
Run Code Online (Sandbox Code Playgroud)

对任何可能出错的想法持开放态度 - 谢谢.

c# checkbox for-loop

0
推荐指数
1
解决办法
72
查看次数

Kotlin(Android)中RecyclerView中不需要的复选框选择

在我的应用程序中,我有一个RecyclerView,其中包含15个静态项目,包括一个TextView和一个CheckBox:

<android.support.v7.widget.RecyclerView
        android:id="@+id/list"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="82dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:scrollbars="vertical" />
Run Code Online (Sandbox Code Playgroud)

单击该项目时,相应的复选框将设置为选中状态,并将该项目添加到选择列表中。

问题:当我向下滚动并选择一个项目时,再次向上滚动我总是看到另一个复选框已选中。在调试时,我注意到,只有我实际选择的项目已添加到列表中,但是,当在UI中随机检查/“选择”其他项目时,这仍然会带来不良的用户体验。

我怎样才能阻止这种奇怪的行为?

我正在使用视图持有者来管理项目视图:

private inner class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
            val checkBox: CheckBox = view.findViewById(R.id.checkbox)
            val text: TextView = view.findViewById(R.id.text)

            init {
                view.setOnClickListener { checkBox.isChecked = !checkBox.isChecked }
                checkBox.setOnCheckedChangeListener { _, isChecked ->
                    val itemText = dataset[adapterPosition]
                    logger.debug("state change $isChecked for $itemText")
                    if (isChecked) selectedItems.add(itemText)
                    else {
                        if (selectedItems.contains(itemText)) selectedItems.remove(itemText)
                    }
                }
            }
        }
Run Code Online (Sandbox Code Playgroud)

我的onBindViewHolder()方法包含以下内容:

override fun onBindViewHolder(holder: MyViewHolder?, position: Int) {
            val itemText = dataset[position]
            holder?.text?.text …
Run Code Online (Sandbox Code Playgroud)

checkbox android kotlin android-recyclerview

0
推荐指数
1
解决办法
1050
查看次数

带有空白标签的Font Awesome CSS复选框

我正在尝试使用FontAwesome获得仅CSS单选和复选框按钮。我在这里有一个jsfiddle

当复选框具有包含内容的标签时,我正在使用以下效果很好的CSS。我现在正尝试在页面上的表格中创建复选框矩阵,并且图标显示为OK,但无法单击/更改状态。

我的CSS:

/**
 * Checkboxes
 */


input[type=checkbox] {
  display: none;
}


/* to hide the checkbox itself */

input[type=checkbox] + label:before {
  display: inline-block;
  letter-spacing: 5px;
  content: "\f0c8";
  font-family: 'Font Awesome 5 Pro';
}


/* unchecked icon */

input[type=checkbox]:checked + label:before {
  content: "\f14a";
  letter-spacing: 5px;
}


/**
 * Radio buttons
 */

input[type=radio] {
  display: none;
}


/* to hide the radio itself */

input[type=radio] + label:before {
  display: inline-block;
  letter-spacing: 5px;
  content: "\f111";
  font-family: …
Run Code Online (Sandbox Code Playgroud)

html css checkbox jquery

0
推荐指数
1
解决办法
1389
查看次数

ag-grid单元格级别复选框

我想显示所有行,所有列都带有复选框,因为我只想要true / false值。但是我想访问单个单元格的值,即每个复选框都可以选中/取消选中。参见下图。

在此处输入图片说明

据我所知,当我勾选复选框时,将选中该行的所有复选框。因此,我可以选中/取消选中单个复选框吗?

checkbox select ag-grid

0
推荐指数
2
解决办法
5179
查看次数

Javascript消息

我在修复JS代码时遇到了一些问题.在代码段中,您可以看到我的程序,

现在单击第一个复选框.一条消息出现在bottem上,只要我输入一个数字,消息应该消失,文本框不应该禁用...

当我单击第二个复选框时,该消息应附加到前一个,但它只是覆盖...然后使用与前一个相同的值...

任何人都可以给我一些想法吗?测试功能应该有问题......

先感谢您.

// JavaScript source code


function test(el)
{
    divOutput = document.getElementById("msgbox2");
    strValideer = "<ul>";
    var txt = document.getElementById(el.id.replace('chk', 'txt'))
    if (el.checked === true ) {
        txt.disabled = false;
        if(txt.value==="")
        {
            strValideer += "<li><b>" + txt.name + ": </b>verplicht veld</li>";
        }
        }
    else if (el.checked === false)
    {
        txt.disabled = true;
      return;

    }

    strValideer += "</ul>";
    divOutput.innerHTML = strValideer;
}
Run Code Online (Sandbox Code Playgroud)
<fieldset>
                <legend>Bestel gegevens</legend>
                <div class="container">
                    <div class="row">
                        <div class="span7" id="houtsoorten">
                            <div class="control-group">
                                <label class="control-label">
                                    bangkirai
                                    <input id="chkbangkirai" …
Run Code Online (Sandbox Code Playgroud)

html javascript checkbox function

0
推荐指数
1
解决办法
71
查看次数

PHP中的foreach - 如何在变量中传递值?

所以问题是,我有一个HTML表单,复选框作为输入选项.我想将所有选定的选项保存为一个变量中的字符串(!).

我很确定解决方案是一个foreach循环,但我的工作不起作用.它只返回最后选择的值.

我怎样才能解决这个问题?

HTML

<form action="" method="post">
<label>category:<br/>
     one <input type="checkbox" name ="ber[]" value="one"><br/>
     two <input type="checkbox" name ="ber[]" value="two"><br/>
     thr <input type="checkbox" name ="ber[]" value="three"><br/>
     fou <input type="checkbox" name ="ber[]" value="four"><br/>
</form>
Run Code Online (Sandbox Code Playgroud)

PHP

foreach ($_POST['ber'] as $value) {
$ber = "$value. ', '"
}
Run Code Online (Sandbox Code Playgroud)

html php arrays checkbox foreach

0
推荐指数
1
解决办法
195
查看次数