0

I have a html page which is displaying a list of records, along with a checkbox for each and every record, by default when a page is loaded all my checkboxes are selected, I can unselect more than one record and finally i will have a submit button.

My requirement is when i click on submit, I need to send the whole objects which are selected. since the records are in a loop , I am unable to get the whole object in the submit button till now i have tried this, but that is only returning the id. please help me out.

Ex: I have a model Employee with 3 properties, Name Age Phone

In my page i have a list of employees,so from controller I got the list of employees, In view i have binded them using forloop. Now in the page i also have a checkbox along with the above three properties. so my table is now having four columns including checkbox.

My requirement is, in the submit click i need to get the whole object(means name, age and phone) of the checked row, like if i have 5 records and if i select only 3 rows , then in the submit click i need to get the employee details who are checked.

function ConvertLifeToELite()
    {

        $('input:checkbox[id^="chkCensus"]:checked').each(function () {
            alert($(this).attr("id"));
        });

    }

But my requirement is, in a button click, I have to get the list of objects which are selected

Liam
  • 27,717
  • 28
  • 128
  • 190
Meena
  • 685
  • 8
  • 31
  • Are you using ajax for this? or any server side language? – Blues Clues May 21 '18 at 08:10
  • Possible duplicate of [Get a list of checked checkboxes in a div using jQuery](https://stackoverflow.com/questions/2155622/get-a-list-of-checked-checkboxes-in-a-div-using-jquery) – peeebeee May 21 '18 at 08:10

0 Answers0