checkbox 相关问题

复选框是一个图形用户界面元素,允许用户进行二进制选择。

Javascript 中待办事项列表的复选框符号

我正在尝试用 JavaScript 创建一个待办事项列表应用程序。我使用 HTML 和 CSS 创建了一个复选标记按钮。问题是添加新任务时不显示复选标记按钮,但是...

回答 1 投票 0

CheckBox 中的 setChecked 和 setSelected 不起作用

我有一个 Activity,其中有 5 个片段。我用了 viewPager.setOffscreenPageLimit(fragmentList.size()); 能够一次性创建所有片段 我还有一个会通过的监听器

回答 2 投票 0

如何通过 mousedown 事件选中复选框?

我有以下代码: checkbox.addEventListener('mousedown', function () { if (!this.checked) { this.checked = true; } }); 当鼠标按钮按下时,它应该打开复选框...

回答 4 投票 0

React Native Elements CheckBox 组件不显示复选标记

我目前正在使用 TypeScript 开发一个 React Native 项目,并且遇到了 React-native-elements 库中的 CheckBox 组件的问题。当...

回答 1 投票 0

如何使用从活动单元格到另一列的最后一个条目的范围(VBA)在空白列中添加字符(163)复选框

我正在尝试使用从活动单元格到另一列的最后一个条目的范围在空白列中使用字符键(163)添加复选框,但到目前为止,我只能在空

回答 1 投票 0

将 Excel 中的“是”或“否”响应转换为 Word 中的勾选复选框

我正在将输入到 Excel 工作表中的信息转换为 Word 文档。我在 Excel 中有一个“是/否”选择部分,当我运行该程序时,该结果将发送到 Word 中的某个位置。我会...

回答 1 投票 0

无法移除复选框原始边框

我正在尝试创建 2 个复选框并自定义它们,使它们看起来像一个带有黑色边框的正方形,而不是原来的灰色圆形边框。 我正在使用 jsreport studio。 HTML 代码: 我正在尝试创建 2 个 checkboxex 并自定义它们,使它们看起来像一个带有黑色边框的正方形,而不是原来的灰色圆形边框。 我正在使用 jsreport studio。 HTML代码: <div class="checkboxTable"> <div class="row"> {{#if Racunala}} <div class="cell"><input class="checkbox" type="checkbox" checked> računala</input></div> {{else}} <div class="cell"><input class="checkbox" type="checkbox"> računala</input></div> {{/if}} {{#if Mobiteli}} <div class="cell"><input class="checkbox" type="checkbox" checked> mobiteli</input></div> {{else}} <div class="cell"><input class="checkbox" type="checkbox"> mobiteli</input></div> {{/if}} </div> </div> CSS: input[type='checkbox'] { accent-color: white; outline: 1px solid black; } .checkboxTable { padding-top: 20px; display: table; margin: auto; } .row { display: table-row; } .cell { display: table-cell; padding-left: 50px; } 我期待这段代码 input[type='checkbox'] { accent-color: white; outline: 1px solid black; } 更改边框,但看起来它在原始边框周围添加了一个新边框(此外,当“选中”复选框时,原始边框会消失,就像我发布的屏幕截图一样)。 我可以以某种方式删除它吗? 你可以尝试: input[type=checkbox] { -moz-appearance:none; -webkit-appearance:none; -o-appearance:none; outline: none; content: none; }

回答 1 投票 0

React Native Paper 复选框项目将标签放在复选框后面

我正在使用React Native Expo 来自库react-native-paper/checkbox-item链接 我获得了可点击标签功能,通过点击文本可以选中复选框。 我收到标签检查...

回答 4 投票 0

onEdit() 依赖于超过 1 个变量

我发现这段代码是由 --Hyde 编写的,我了解它的一半工作原理,但它工作得很好。如果 B 列的一个单元格不为空,则触发在 A 列的一个单元格中创建复选框....

回答 1 投票 0

更改选中复选框上的 CSS 内容

我有这个标题,里面有一个菜单。我可以在选中复选框时打开菜单,但我不知道如何解决我希望 CSS 内容从汉堡菜单更改为关闭 ic...

回答 1 投票 0

如何将控制器的范围属性传递给自定义指令?

基本设置: 我有一个模态表单,其中有一个自定义指令(子元素)。自定义指令是一个按钮。该模式还包含一个输入复选框。 最终目标: 什么时候...

回答 4 投票 0

更新并设置初始值以反应钩子形式

我是 React/TypeScript 和 Chakra UI 的新手。我有以下问题 在这里我得到要更新的当前对象: 常量{ 数据:司法原因, 正在加载, 错误, 更新司法原因, } =

回答 1 投票 0

如果其他复选框被选中为 true,则取消选中其他复选框

我有一张带有3个表单控件复选框的工作表,而不是ActiveX(复选框16,复选框17和复选框18),并且所有这些都链接到单元格 - 因为它们链接到它们的单元格,所以我不能.. .

回答 1 投票 0

Jquery 如果选中一个复选框,则禁用其他复选框

我有一组 php 生成的复选框: 我有一组 php 生成的复选框: <?php foreach($checkbox as $check) {?> <input type = "checkbox" name="checkbox[]" class="<?php echo $check -> class ?>" value ="<?php echo $check -> value ?>" /><?php echo $check->value ?> <?php } ?> 上面 PHP 生成下面的 HTML: <input type="checkbox" name="checkbox[]" class="class1" value="Checkbox1" />Checkbox1 <input type="checkbox" name="checkbox[]" class="class1" value="Checkbox2" />Checkbox2 <input type="checkbox" name="checkbox[]" class="class1" value="Checkbox3" />Checkbox3 <input type="checkbox" name="checkbox[]" class="class2" value="Checkbox4" />Checkbox4 <input type="checkbox" name="checkbox[]" class="class2" value="Checkbox5" />Checkbox5 <input type="checkbox" name="checkbox[]" class="class2" value="Checkbox6" />Checkbox6 <input type="checkbox" name="checkbox[]" class="class3" value="Checkbox7" />Checkbox7 <input type="checkbox" name="checkbox[]" class="class3" value="Checkbox8" />Checkbox8 为了解释上面的内容,我有三类复选框,并且希望这样: 如果我选中 class1 中的任何一个,class3 将被禁用,如果我取消选中,class3 将重新启用。 如果我选中 class2 ,所有其他 class2 都会被禁用,如果已经选中 class1 则保持选中状态,如果没有选中则变为选中状态。 我尝试使用下面的脚本来执行此操作。 $('input[class*="class"]').click(function(){ if($(this).is(':checked')){ var classValue = $(this).attr('class'); if(classValue == 'class1'){ $('.class3').prop('disabled', true); $('.class3').prop('checked', false); } else if(classValue == 'class2'){ $('.class2').not(':checked').prop('disabled', true); $('.class3').prop('disabled', true); } else if(classValue == 'class3'){ $('.class1').prop('checked', false); $('.class2').prop('checked', false); $('.class1, .class2').prop('disabled', true); } } }) 但不起作用。 $('input[class^="class"]').click(function() { var $this = $(this); if ($this.is(".class1")) { if ($(".class1:checked").length > 0) { $(".class3").prop({ disabled: true, checked: false }); } else { $(".class3").prop("disabled", false); } } else if ($this.is(".class2")) { if ($this.is(":checked")) { $(".class2").not($this).prop({ disabled: true, checked: false }); $(".class1").prop("checked", true); } else { $(".class2").prop("disabled", false); } } }); 小提琴 试试这个http://jsfiddle.net/EACk4/ $(document).ready(function(){ $('.class1').on('change', function(){ if($('.class1:checked').length){ //or $('.class3').prop({disabled: 'disabled', checked: false}); $('.class3').prop('disabled', true); $('.class3').prop('checked', false); return; } $('.class3').prop('disabled', false); }); $('.class2').on('change', function(){ if(!$(this).prop('checked')){ $('.class2').prop('disabled', false); return; } $('.class2').prop('disabled', true); $(this).prop('disabled', false); !$('.class1:checked').length ? $('.class1').click() : ''; }); }) 我稍微修改了你的代码——我认为它实现了你想要的。 $('input[class*="class"]').click(function(){ var classValue = $(this).attr('class') ,isChecked = $(this).is(':checked'); if(classValue == 'class1'){ if( !isChecked && $('.' + classValue + ':checked').length > 0 ) { return; } $('.class3').prop('disabled', isChecked ? true : false); $('.class3').prop('checked', isChecked ? false : null); } else if(classValue == 'class2'){ if( isChecked && $('.class1 :checked').length <= 0 ){ $('.class1').prop('checked', true); } $('.class2').not(':checked').prop('disabled', isChecked ? true : false); $('.class3').prop('disabled', isChecked ? true : false); } else if(classValue == 'class3'){ $('.class1, .class2').prop('checked', isChecked ? false : null); $('.class1, .class2').prop('disabled', isChecked ? true : false); } }) 这是一个非常古老的问题,我发现很有用 - 谢谢! 我对此进行了一些修改,以实现更简单的用例...您只想拥有一个选项列表,其中一个选项取消选中并禁用所有其他选项。取消选中触发该条件的选项将重新启用其他选项 HTML 示例 Chooose one:<br /> <input type="checkbox" name="choices-1" class="n_remove" value="1" />choice 1<br /> <input type="checkbox" name="choices-2" class="n_remove" value="2" />choice 2<br /> <input type="checkbox" name="choices-3" class="n_remove" value="3" />choice 3<br /> <input type="checkbox" name="choices-1" class="n_check" value="4" />none of the above<br /> 示例 JavaScript $(document).ready(function(){ $('.n_check').click(function() { var $this = $(this); if ($this.is(".n_check")) { if ($(".n_check:checked").length > 0) { $(".n_remove").prop({ disabled: true, checked: false }); } else { $(".n_remove").prop("disabled", false); } } }); }); 小提琴 https://jsfiddle.net/xkyucg6L/

回答 4 投票 0

Flutter CheckBoxList 未选择

我有一个 ListViewBuilder,其中包含来自 Firestore 的数据。在我的列表中,我想返回一个 ListTile 并将 CheckBox 添加到 ListTile 或返回一个 CheckBoxListTile,以效果更好者为准。 但由于某些原因,...

回答 1 投票 0

多复选框搜索wordpress

我需要多个复选框搜索才能工作,但我陷入困境。表格没问题,但我不知道如何进行查询。请有人帮助我吗? 形式 : 我需要多个复选框搜索才能工作,但我被困住了。表格没问题,但我不知道如何进行查询。有人请帮助我吗? 表格: <input id="propertytype" class="noborder" type="checkbox" name="propertytype2[]" value="Loft"><div class="lbl">Loft</div> <input id="propertytype" class="noborder" type="checkbox" name="propertytype2[]" value="Studio"><div class="lbl">Studio</div> <input id="propertytype" class="noborder" type="checkbox" name="propertytype2[]" value="2 pieces"><div class="lbl">2 pièces</div> <input id="propertytype" class="noborder" type="checkbox" name="propertytype2[]" value="3 pieces"><div class="lbl">3 pièces</div> <input id="propertytype" class="noborder" type="checkbox" name="propertytype2[]" value="4 pieces"><div class="lbl">4 pièces</div> <input id="propertytype" class="noborder" type="checkbox" name="propertytype2[]" value="5 pieces"><div class="lbl">5 pièces</div> <input id="propertytype" class="noborder" type="checkbox" name="propertytype2[]" value="6 pieces et +"><div class="lbl">6 pièces et +</div> <input id="propertytype" class="noborder" type="checkbox" name="propertytype2[]" value="Proprietes, Hotels particuliers"><div class="lbl">Propriétés, Hôtels particuliers</div> 查询: $search_propertytype = ""; if (isset($_POST['propertytype2'])) { $search_propertytype = trim($_POST['propertytype2']); } if (get_option('wp_search_propertytype') == "Yes") { if($search_propertytype != '') { $search_propertytype = trim($search_propertytype); $query ="SELECT p.* FROM $wpdb->posts p, $wpdb->postmeta p1 WHERE p.ID = p1.post_id AND (p1.meta_key='propertytype_value' AND p1.meta_value='$search_propertytype' OR p1.meta_key='propertytype2_value' AND p1.meta_value='$search_propertytype')"; $sptt = getIds( $query ); $_ids = ( !empty($sptt) ? ( !empty($_ids) ? array_intersect( $_ids, $sptt) : "" ) : "" ); } } 我通过 WP_Query 和自定义元框制定了解决方案。我的查询参数如下: $args = array( 'post_type' => 'product', 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'color', 'value' => 'blue', 'compare' => 'NOT LIKE' ), array( 'key' => 'price', 'value' => array( 20, 100 ), 'type' => 'numeric', 'compare' => 'BETWEEN' ) ) ); $query = new WP_Query( $args ); 查看wordpress官方文档:http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters 您可以通过这种方式查看。也许它能有所帮助。谢谢。

回答 1 投票 0

Vue 中带有复选框的嵌套表

所以我有一个嵌套表格,我希望表格标题中的复选框自动检查其子项中的所有复选框 这是我的 vue 代码: // 模板 所以我有一个嵌套表格,我希望表格标题中的复选框自动检查其子项中的所有复选框 这是我的 vue 代码: // TEMPLATE <table class="table"> <thead> <tr> <th><input type="checkbox" value="row-all" v-model="selectAllCheckbox"></th> --> CHECKBOX IN HEADER OF PARENT TABLE ... </tr> </thead> <tbody> <tr> <td><input type="checkbox" :value="`row-${row.id}`" v-model="checkedRows"></td> --> CHECKBOX IN BODY OF PARENT TABLE ... </tr> <tr> <table> <thead> <tr> <th><input type="checkbox" :value="`child-${row.id}`" v-model="selectAllCheckbox"></th> --> CHECKBOX IN HEADER OF CHILD TABLE ... </tr> </thead> <tbody> <tr> <td><input type="checkbox" :value="`child-${row.id}-row-${index}`" v-model="checkedRows"></td> --> CHECKBOX IN BODY OF CHILD TABLE </tr> </tbody> </table> </tr> </tbody> </table> // SCRIPT const selectAllCheckbox = ref(new Set()) const checkedRows = ref(new Set()) watch(() => selectAllCheckbox.value, () => { if (selectAllCheckbox.value.has('row-all')) { for (const key in shownData.value) { checkedRows.value.add(`row-${shownData.value[key].id}`) } } else { for (const key in shownData.value) { checkedRows.value.delete(`row-${shownData.value[key].id}`) } } for (const key in shownData.value) { if (selectAllCheckbox.value.has(`child-${shownData.value[key].id}`)) { for (let index = 0; index < shownData.value[key].product_entries.length; index++) { checkedRows.value.add(`child-${shownData.value[key].id}-row-${index}`) } } else { for (let index = 0; index < shownData.value[key].product_entries.length; index++) { checkedRows.value.delete(`child-${shownData.value[key].id}-row-${index}`) } } } }) watch(() => checkedRows.value, () => { let condition = true for (const key in shownData.value) { if (!checkedRows.value.has(`row-${shownData.value[key].id}`)) { condition = false } } if (condition) { selectAllCheckbox.value.add('row-all') } else { selectAllCheckbox.value.delete('row-all') } for (const key in shownData.value) { condition = true for (let index = 0; index < shownData.value[key].product_entries.length; index++) { if (!checkedRows.value.has(`child-${shownData.value[key].id}-row-${index}`)) { condition = false } } if (condition && shownData.value[key].product_entries.length > 0) { selectAllCheckbox.value.add(`child-${shownData.value[key].id}`) } else { selectAllCheckbox.value.delete(`child-${shownData.value[key].id}`) } } }) 我的主要问题是关于复选框。现在上面的代码工作正常,我的问题是: 如你所见,我在 watch 函数中放了大概一百多个循环,这样可以吗?我的意思是,应用程序会很慢吗? 如果上面的答案是肯定的,那么我该如何解决这个问题呢?有没有例子可以解决这个问题? 您可以使用 :checked 和 @input 的组合: VUE SFC 游乐场 <script setup> import { reactive, computed } from 'vue' const props = defineProps({items:Array}); const selectedRows = reactive(new Set); const allSelected = computed({ get(){ return selectedRows.size === props.items.length; }, set(val){ val ? props.items.forEach(item => selectedRows.add(item.id)) : selectedRows.clear(); } }); </script> <template> <table> <thead> <tr><td><input type="checkbox" v-model="allSelected"></td></tr> </thead> <tbody v-for="item in items"> <tr><td><input type="checkbox" :checked="selectedRows.has(item.id)" @input="selectedRows[selectedRows.has(item.id) ? 'delete' : 'add'](item.id)"/></td><td>{{ item.title }}</td></tr> <tr><td colspan="2" style="padding-left:32px"><table-select v-if=item.children :items="item.children"/></td></tr> </tbody> </table> </template>

回答 1 投票 0

使用 PDO 将复选框选择存储到 MySQL 数据库表中

我有一个可选服装项目列表作为复选框,数量可能比下面的 5 个更多。 鞋子、裤子、裙子、袜子、夹克//可能的选择列表 逗号分隔的数组是创建...

回答 3 投票 0

如何更改material-ui中复选框的边框半径?

我在我的React应用程序中导入了material-ui,我可以更改复选框的颜色和大小,如您所见,但我无法更改图标borderRadius,我应该怎么做? 从 '@mui/

回答 2 投票 0

Extjs:如何在加载网格时使用渲染器启用/禁用复选框

我需要根据得到的查询结果加载网格。我在网格中加载文本字段时没有任何问题,但有一个特定的列是复选框类型。我正在使用...

回答 4 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.