I have a table , I want to get value of some checkbox and push in string. Then I'm trying a function to get value , but it shows object Object, It`s not working.
<table id="div_table" border="2px" >
<tbody>
<tr>
<td><input type="checkbox" value="ABC" /></td>
<td>
<input type="checkbox" value="123" />
<input type="checkbox" value="456" />
<input type="checkbox" value="789" />
</td>
<td><input type="checkbox" value="xyz2" />
<input type="checkbox" value="xyz1" />
</td>
</tr>
</tbody>
</table>
I tried code java function
function getvalue_func()
{
$('#div_table > tbody > tr').each(function()
{
var str = '';
$(this).find('td').find("input:checked").each(function ()
{
for (var i = 0; i < $(this).length; i++)
{
str += $(this).val() + ',';
}
return alert(str);
});
});
}
Example : I check some checkbox: ABC,123,456 and xyz2 . Result : ABC,123,456,xyz2