- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当复选框被选中时,删除和复选框计数器按钮应该像 Chrome 历史记录一样显示,如果你检查任何访问过的页面,标题会发生变化如果我点击第二行,它不会显示。
<tbody>
{% for item in items %}
<th scope="row"><input type="checkbox" id="check" name="wpmm[]"></th>
<td>{{ item.item_name }}</td>
<td>{{ item.sku }}</td>
<td>{{ item.quantity }}</td>
{% endfor %}
</tbody>
这是脚本:
var fnUpdateCount = function () {
var generallen = $("input[name='wpmm[]']:checked").length;
if (generallen > 0) {
$("#general i .counter").text('(' + generallen + ')');
} else {
$("#general i .counter").text(' ');
}
};
$("input:checkbox").on("change", function () {
fnUpdateCount();
});
$('.select_all').change(function () {
var checkthis = $(this);
var checkboxes = $("input:checkbox");
if (checkthis.is(':checked')) {
checkboxes.prop('checked', true);
} else {
checkboxes.prop('checked', false);
}
fnUpdateCount();
});
这是选中复选框时应显示的代码:
<div class="row justify-content-between start-dash mb-4" id="general">
<div class="col-6">
<h4 class="text-left mt-4">Selected Items: <span class="counter"></span></h4>
</div>
</div>
为此使用此代码:
$('#general').hide();
$(function () {
$('#check').on('change', function () {
if ($('#check').prop('checked')) {
$('#item_info').hide();
$('#general').show();
} else {
$('#item_info').show();
$('#general').hide();
}
});
});
最佳答案
试试这个:
$(function () {
$('body').on('change','#check', function (e) {
e.preventDefault();
if ($(this).prop('checked')) {
$('#item_info').hide();
$('#general').show();
} else {
$('#item_info').show();
$('#general').hide();
}
});
});
关于javascript - 复选框只生效一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56003034/
我希望在通过 POST 方法发送数据后文本框消失。但我无法让 Javascript 工作。页面不断重新加载,因此文本框始终存在。 function puff() { if (document.get
我无法让 expand_aliases 在 bash 中生效。我尝试了很多不同的方法,但没有任何效果。 这是一个简单的测试用例: /bin/bash -c 'shopt -s expand_alias
我正在尝试查找 #include 位于 extern C block 内的所有位置。是否可以使用预处理器进行检查?我想在我的头文件中添加类似这样的内容: #ifdef EXTERN_C_IS_IN_E
我们扩展了 UILabel,以便能够为我们应用程序中给定标签类型的所有用途应用标准字体和颜色。例如。 @interface UILabelHeadingBold : UILabel @end 在我们的
案例1 我们正在尝试将自定义样式应用于渲染的 vuetify 元素: .input-group__input { background: red; } 但是没有任何变化。 案
我正在使用 symfony 1.4 和 sfGuardDoctrinePlugin,我已经安装并设置好了,但我遇到以下问题: 如果我以管理员身份登录并更新用户的权限,该用户必须注销然后重新登录才能获得
getElementsByTagName() 有 2 个很棒的特性:速度快且实时。但是,如果我想获得 p strong 怎么办。当然,我可以再次使用 getElementsByTagName() 优化
我有三个文件: spark_mock_dependency.py 提供了一个user() 方法来读取/etc/user, spark_mock.py 用于创建一个 Env 类,它使用 user() 方
我从 samples/bpf/pare_simple.c(来自 Linux 内核树)编译了 BPF 示例,做了非常简单的更改: SEC("simple") int handle_ingress(str
我有一个基本的树结构。容器可以水平滚动。我在所有 上都有正确的填充元素。但是,正确的填充没有生效。我该如何修复它才能生效? ul { height: 100%; margin: 0; p
我目前在使用 Ruby on Rails 上的 Assets 管道时遇到了一些问题。 我正在使用电子商务解决方案 (Spree),在文档中,文档中有这个: [...] you can improve
在我们非常庞大且非常复杂的 AngularJS 应用程序中,我注意到(偶然!)我的主模块设置中有这样一行... application.run(function($rootScope) { w
我发现重写getResources()后app第一次运行的activity也会对后面运行的activity生效,前提是你的手机字体特别大。 例如:执行以下步骤 将手机字体设置为巨无霸 创建两个名为 A
我正在尝试使用 KVO 来观察在我的页面 View Controller 的子内容 View Controller 的 ScrollView 中使用拖动时的更新变化,但是当应用程序启动时,它崩溃了说:
我是一名优秀的程序员,十分优秀!