jquery - 单击时识别重复的行值
问题描述
如果行officelocation_id
中的行不同,我将选择行,但我面临识别officelocation_id
所有行以应用条件以仅选择相同的问题officelocation_id
。
<table class="supplier_inquiry_indextable">
<tr>
<th>Check</th>
<th>Office location</th>
</tr>
<?php foreach ($purchaseOrder as $key=>$supplierInquiry): ?>
<tr class="inquiryrow">
<td>
<?php echo $this->Form->checkbox("data.$key.selectpr", array('class'=>'selectcheck', 'value'=>supplierInquiry->id));?>
</td>
<td><php echo $supplierInquiry['office'];
echo $this->Form->hidden("data.$key.officelocation_id",[ 'class'=>'officelocation_id ', 'value'=>$supplierInquiry['officelocation_id']]);?>
</td>
</tr>
</table>
<script>
$(document).ready(function() {
$(".supplier_inquiry_indextable").each(function(){
$(this).find(".inquiryrow").each(function(){
var inqrow=this;
$(inqrow).find(".suppliername").prop('disabled', true);
$(inqrow).find(".selectcheck").click(function(){
var ischecked= $(this).is(':checked');
if(ischecked){
$(inqrow).css('background-color','#3c8dbc');
}else if(!ischecked){
$(inqrow).css('background-color','white');
//$(inqrow).empty();
}
});
});
});
});
</script>
在我上面的代码中,我能够找到选定的行,但单击时我必须选择唯一相同的办公位置,否则会出现警报。
解决方案
推荐阅读
- wpf - 通过双击标题最大化窗口时,WPF DataGrid MouseLeftButtonUp 被触发
- json - 我在哪里可以获得假的商店 JSON 以便我可以练习获取数据?
- android-gradle-plugin - Gradle 使用 Fabric 插件构建 Crashlytics 和 groovy 插件 DSL
- node.js - 如何从 JSON 格式的查询中获得结果?
- android - 突然“会话'应用程序':启动活动出错”?
- windows - 在 Windows 上使用自动热键模拟 jumpapp
- bash - 如何组合两个字符串并将其用作变量?
- swift - UICollectionView Cell 在选择时不会改变
- angular - Firebase 上托管的 Ionic 4 应用程序仅在重新加载时返回 404
- go - 如何在 Go 中嵌套结构