jquery - 如果输入有值,如何打开折叠?
问题描述
我正在努力做到这一点,如果 div 的任何输入中有值,则显示 div。我正在使用引导崩溃。
我写了一个这样的函数,但它没有用
$(function() {
$("collapseExample .collapse").each(function () {
if ($(this).find('.kgad2').length > 0)
$(this).collapse('show');
});
event.preventDefault();
});
这是html
<div class="collapse" id="collapseExample">
<div class="card card-body">
<div class="col-md-12">
<table id="ekkagit" class="table table-condensed">
<thead>
<tr>
<th bgcolor="#00FF00">
<strong>Ek Kağıt 1</strong>
</th>
<th>Tabaka</th>
<th>Kg Fiyatı</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input id="kgad2" name="kgad2" type="text" value="">
<?php echo $sonuc['kgad2'] ?>" class="form-control inst_amount7">
</td>
<td>
<input id="kgfiyat2" name="kgfiyat2" type="text" value="">
<?php echo $sonuc['kgfiyat2'] ?>" class="form-control inst_amount7">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
解决方案
推荐阅读
- reactjs - 如何将数组值传递给另一个组件?
- botframework - 无法从 Linux Mint 20.2 上的 Azure 门户打开 Bot Framework Composer
- r - 在条件下重建 tibble
- r - 控制图例在 GGplot 中的位置
- html - 如何更改导航栏下拉菜单的背景颜色?
- amazon-web-services - 允许 bash 脚本在 AWS Centos 7 实例中启动时运行
- python - 正态分布->分布函数->Python中的生存函数
- python - 在功能上,torch.multinomial 是否与 torch.distributions.categorical.Categorical 相同?
- android - 使用 RSA OAEP 解密的 Android 上的 MGF1 不支持 SHA-256 摘要?
- javascript - createError.js:16 未捕获(承诺)错误。reactJS到mongodb连接