160
rated 0 times
[
166]
[
6]
/ answers: 1 / hits: 23063
/ 9 Years ago, fri, june 12, 2015, 12:00:00
How can I get value of checkbox in table? I want use it for in this case in order get parameter. Now, please see html table:
<table id=div_func class=table table-bordered style=width: 100%>
<thead>
<tr>
<th>
<input type=checkbox id=chk_all /></th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td> <input type=checkbox class=checkbox1 id=chk name=check[] value=D01 /></td>
<td>Banana </td>
</tr>
<tr>
<td> <input type=checkbox class=checkbox1 id=chk name=check[] value=D02 /></td>
<td>Orange </td>
</tr>
<tr>
<td> <input type=checkbox class=checkbox1 id=chk name=check[] value=D03 /></td>
<td>Apple </td>
</tr>
</tbody>
</table>
And this is my script , I use for get value in checkbox , then put parameter
function add_funcgroup() {
var func_group = [];
var chk_allow = ;
var table = document.getElementById(div_func);
for (var i = 0; i < table.rows.length; i++) {
if ($('#chk')[i].is(':checked')) {
chk_allow = True;
}
else {
chk_allow = False;
}
var group_func = {
GROUP_MOD_ID: id_temp,
FUNCTION_MOD_ID: $('#chk')[i].val(),
ALLOW: chk_allow
};
func_group[i] = group_func;
}
var func_group_temp = {
FUNC_MOD: func_group
};
var DTO = {
'func_group_temp': func_group_temp
};
$.ajax(
{
And it's not working.
More From » jquery