Dynamic checkboxes are created using the below code.
var list = new Array();
for(var i=0; i<data.length; i++)
{
$('#cContainer').append('<input type="checkbox" name="catChkBox" class="ckbox"
id = "'+ data[i].id +'" value="'+ data[i].id + '" /> ' + data[i].name + '<br
/>');
}
The above code is inside document.ready function. I want to collect the checked values ie. data[i].name outside document.ready and put it in a list.
I tried the below code which displays only the id. But what I need is the text. Here it is data[i].name (I get this from dwr call)
function showSelectedValues()
{
alert("--------------" + $("input[name=catChkBox]:checked").map(
function () {return this.value;}).get().join(","));
}
I will call showSelectedValues() from some other method where I will make use of the values.
Any idea for this???