У меня есть таблица, в которой у каждой строки есть флажок, связанный со строкой (то же имя). Поэтому я хочу позволить пользователю выбрать один или несколько флажков и удалить его. Проблема в том, что строки принадлежат двум классам информации. поэтому у меня есть строка с именем класса 1
и строки с именем класса 2
. Это код, который я разрабатываю до сих пор:
function delete() {
// here i take all the checkbox checked
var checked = $("input[type=checkbox]:checked");
// the number of checkbox checked
var nbChecked = checked.size();
// just to the dialog
var b = nbChecked == 1 ? "notification" : "notifications";
if (confirm('Are you sure to delete [' + nbChecked + '] ' + b + "?\nTake care.. you cannot resume the action!")) {
if (nbChecked > 1) {
// i want to generate a matrix. every row has an array of information.
var arr1;
// i take this code on web, but it doesn't work. I want to pur in sent all
// the tr with class sent and with input checkbox associated with it checked.
var sent = $('.mainTable').find("tr.sent input[type=checkbox]:checked").get();
//HERE i want to iterate array sent to take all the information of td inside it and pur in arr1.
//HERE THE SAME DONE STILL NOW BUT CHANGING TR CLASS
} else {
// HERE IS SIMPLE
}
}
}
EDIT:
Это один из рядов с именем класса sent
:
<TR valign=top name="rowSent1" style="background-color: #33CCCC" class="sent">
<input type="hidden" value="messageRowSent1" name="message"/>
<TD width=12>
<div class="wpmd">
<div align=center>
<font color="#FF0000" class="ws7">
<input type="checkbox" name="rowSent1" onchange="analizeCheckBox()"/> // onchange to check inputs checked
</div>
</div>
</TD>
<TD width=147 >
<div class="wpmd">
<div align=center>
<font color="#000000" class="ws7"><I><div class="info1">info1</div></I></font>
</div>
</div>
</TD>
<TD width=156 >
<div class="wpmd">
<div align=center>
<font color="#000000" class="ws7"><I><div class="info2">info2</div></I></font>
</div>
</div>
</TD>
</TR>
Тогда у меня есть другие строки с тем же классом и другие строки с другим именем класса.
Вы можете мне помочь? спасибо !!!!