I have a table which I added the rows dynamically. Each row has unique ID and a checkbox. Now I need to constantly check through each added row to see if the checkbox for each row is checked. If they are checked, the information on that row should be collected to post to a python function.
我有一个表,我动态添加了行。每行都有唯一的ID和一个复选框。现在我需要不断检查每个添加的行,看看是否检查了每行的复选框。如果选中它们,则应收集该行的信息以发布到python函数。
Any hints on how should I go about doing it? I have tried a few but they don't seem to work. Looks like my way of solving may be wrong.
关于我应该怎么做的任何提示?我尝试了一些,但它们似乎没有用。看起来我的解决方式可能是错误的。
EDIT: Here's my trial code: http://jsfiddle.net/yvonnezoe/jsXWe/ it just won't append what I want in div #test
编辑:这是我的试用代码:http://jsfiddle.net/yvonnezoe/jsXWe/它只是不会在div中附加我想要的内容#test
$('#status_table tr').each(function(){
$check=$('#status_table #monitor_'+rowID)
if ($check.is(':checked')){
monitoring(rowID);
}
});
1 个解决方案
#1
1
$('#mytable tr input[type="checkbox"]').each(function(){
//inside this callback, 'this' will refer to a selected node (a checkbox)
if ( $(this).is(':checked') ){
....
}
})
Here is an example fiddle
这是一个小例子
#1
1
$('#mytable tr input[type="checkbox"]').each(function(){
//inside this callback, 'this' will refer to a selected node (a checkbox)
if ( $(this).is(':checked') ){
....
}
})
Here is an example fiddle
这是一个小例子