how to create dynamic checkbox using jquery
1. Generate .....
Textbox generate then attach checkbox in all generated textbox
2. Calculation...
Total 6 textbox and chk box generated and fill the value in all textbox but checkbox check only 3 textbox then sum button click calculate only checked textbox value and display in total ...
please help me ....
my textbox generated code and Calculate value using without Checkbox ..
--------------------------------Code----------------------------------------
$(document).ready(function ()
{
$("#btnshow").click(function ()
{
var rows = $("#txtRows").val();
var columns = $("#txtColumns").val();
var htmlData = "";
for (var i = 0; i < rows; i++)
{
//var $ctr = $('').attr({ type: 'checkbox', name: 'chk' }).addClass("chk");
//$("#tblGnrate").append($ctrl);
htmlData += ""; ";
for (var j = 0; j < columns; j++)
{
htmlData += " "
}
htmlData += "
}
$("#tblGnrate").html(htmlData);
});
// sum all the text box values
var Total = 0;
$("#btnsum").click(function ()
{
$('#tblGnrate').each(function (i, row)
{
var $row = $(row), $txtbox = $row.find('input[name="txtValue"]');
$txtbox.each(function (i, txtbox)
{
var $t = $(txtbox);
Total = Total + parseInt($t.val(),10);
});
});
alert(Total);
Total = 0;
});
});
Rows:
Columns:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
please provide textbox and checkbox code and sum value only checked textbox
Deepak AwashtiPosted Dec 16, 2015, 2:24 AM
Deepak AwashtiPosted Dec 16, 2015, 1:28 AM
Deepak AwashtiPosted Dec 16, 2015, 1:15 AM
Upendra Pratap ShahiPosted Dec 15, 2015, 10:57 AM
Manas MohapatraPosted Dec 15, 2015, 7:59 AM
Manas MohapatraPosted Dec 15, 2015, 7:08 AM
Deepak AwashtiPosted Dec 15, 2015, 6:32 AM
Manas MohapatraPosted Dec 15, 2015, 5:23 AM