How to check all the check boxes in a Div and check the check boxes Row wise?
<p>Hi all i want to check all the checkboxes in div on click, i have a grid type designed structure made of divs in the header column i have an check box column and in the,what i want is when i click on a main check box all the check boxes of the div should be checked </p>

<p>**if i check any one of the checkbox from the checkbox column all the checkboxes in that row should be checked based on the check box checked from the checkbox column..</p>

<p>i have been trying some thing i had done with checking all the checkboxes but when i click on the checkboxes all the checkboxes should be unchecked </p>

<p>this is  a sample JSFiddle </p>

<pre><code>&lt;div class="grid row-fluid" id="rolegrid"&gt;
    &lt;div&gt;
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="commoncheckbox" name="alcolumncheckbox" class="regular-checkbox" &gt;&lt;label for="commoncheckbox"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt; 
        &lt;span class="span1"&gt;Page Name&lt;/span&gt;
        &lt;span class="span1"&gt;Add&lt;/span&gt; 
        &lt;span class="span1"&gt;Edit&lt;/span&gt;
        &lt;span class="span1"&gt;Delete&lt;/span&gt;
        &lt;span class="span1"&gt;View&lt;/span&gt;                    
    &lt;/div&gt;
    &lt;div&gt;
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="rowcommoncheckbox-@rowcommon" name="selectedObjects" value="@item.Value"   class="regular-checkbox"&gt;&lt;label for="rowcommoncheckbox-@rowcommon"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt; 

        &lt;span class="span1"&gt;@item.Text&lt;/span&gt;
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="Add-@Add"  name="txtAdd" class="regular-checkbox"&gt;&lt;label for="Add-@Add"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;  
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="Edit-@Edit"  name="txtEdit" class="regular-checkbox"&gt;&lt;label for="Edit-@Edit"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;  
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="Delete-@Delete"  name="txtDel" class="regular-checkbox"&gt;&lt;label for="Delete-@Delete"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;  
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="View-@View" name="txtCheck" class="regular-checkbox"&gt;&lt;label for="View-@View"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;                                      
    &lt;/div&gt;     
    &lt;div&gt;
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="rowcommoncheckbox-@rowcommon" name="selectedObjects" value="@item.Value"   class="regular-checkbox"&gt;&lt;label for="rowcommoncheckbox-@rowcommon"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;  
        &lt;span class="span1"&gt;@item.Text&lt;/span&gt;
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="Add-@Add"  name="txtAdd" class="regular-checkbox"&gt;&lt;label for="Add-@Add"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;  
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="Edit-@Edit"  name="txtEdit" class="regular-checkbox"&gt;&lt;label for="Edit-@Edit"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;  
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="Delete-@Delete"  name="txtDel" class="regular-checkbox"&gt;&lt;label for="Delete-@Delete"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;  
        &lt;span class="span1"&gt;&lt;label class="checkbox"&gt;&lt;input type="checkbox"  id="View-@View" name="txtCheck" class="regular-checkbox"&gt;&lt;label for="View-@View"&gt;&lt;/label&gt;&lt;/label&gt;&lt;/span&gt;                                      
    &lt;/div&gt;       
&lt;/div&gt;    ​


$('input[name="alcolumncheckbox"]').click(function () {
    alert(1);
    $("#rolegrid :checkbox").attr('checked', $(this).attr('checked'));
});​
</code></pre>

<p>can any one help me here please?</p>
