May 9, 2013

how to know whether check box is checked or not

Veena’s Questions:

$('[name="SelectHighlights"]:checked').each(function () {
        var row = $(this).closest('tr');


        var high = {
            AccountId: row.find('td:nth-child(3)').text(),
            Highcomments: row.find('td:nth-child(4)> input').val()
        };
        HighlightsArea.push(high);

    });

this is my code for retreiving the rows with checkbox checked

how to retreive the rows where check box is not checked

Please help me
Thanks in advance

Use :not() selector

$('[name="SelectHighlights"]:not(:checked)').each(function () {
    var row = $(this).closest('tr');


    var high = {
        AccountId: row.find('td:nth-child(3)').text(),
        Highcomments: row.find('td:nth-child(4)> input').val()
    };
    HighlightsArea.push(high);
 });

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!