Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用jQuery根据选中的复选框和其他单元格是否满足某些条件来修改表单元格值?_Jquery_Select_Html Table_Row_Each - Fatal编程技术网

如何使用jQuery根据选中的复选框和其他单元格是否满足某些条件来修改表单元格值?

如何使用jQuery根据选中的复选框和其他单元格是否满足某些条件来修改表单元格值?,jquery,select,html-table,row,each,Jquery,Select,Html Table,Row,Each,我有一个简单的表,如果选中了该行中的复选框,并且另一个单元格的值至少为5,我想在td单元格中创建一个标志。我知道如何选中复选框并更改单元格,但我不知道如何使用jQuery来处理“另一个单元格至少是5”部分。这是我的JSFIDLE和我到目前为止的示例。我还希望在用户更改复选框的值时对此进行重新检查 见此: $('.mySortedTable').ready(function() { $(".mySortedTable input.myChkBox:checked").closest('tr

我有一个简单的表,如果选中了该行中的复选框,并且另一个单元格的值至少为5,我想在td单元格中创建一个标志。我知道如何选中复选框并更改单元格,但我不知道如何使用jQuery来处理“另一个单元格至少是5”部分。这是我的JSFIDLE和我到目前为止的示例。我还希望在用户更改复选框的值时对此进行重新检查

见此:

$('.mySortedTable').ready(function() {
    $(".mySortedTable input.myChkBox:checked").closest('tr').find('td:eq(2)').text("Yes"); 
});
$('.mySortedTable').ready(function() {

 $('.mySortedTable').find('tr').each(function(){

  if($(this).find('input.myChkBox').is(':checked') && parseInt($(this).find('td:eq(1)').html(),10) > 4)
    {
        $(this).find('td:eq(2)').text("Yes");
    }
 });
});