check or uncheck all checkboxes based on a condition
<p>I have this html </p>

<pre><code>   @foreach (var item in Model.Options)
  {
     &lt;input type="checkbox" checked="checked" name="selectedObjects" noneoption=@(item.OptionText=="None of the above" ? "true" : "false") id="@(Model.QuestionNo)_@(item.OptionNumber)_chk" value="@item.OptionNumber" onchange="checkBoxChangeNone(this);" /&gt; 
   }
</code></pre>

<p>My condition </p>

<p>1.when a user click on a checkbox if its contain <strong><em>noneoption=true</em></strong> then all other checkboxes are unchecked. </p>

<p>2.When a user click on checkbox that contain  <strong><em>noneoption=false</em></strong> if a checkbox with <strong><em>noneoption=true</em></strong> checked it must unchecked. </p>

<p>i have written this JS but its not working.</p>

<pre><code>        function checkBoxChangeNone(checkbox) {
        var noneoption = $(checkbox).attr('noneoption');
        var checkid = '#' + checkbox.id;
        var splitstr = checkbox.id.split('_');
        var formid = $('#myform_' + splitstr[0]); 
        if (noneoption == 'true') {
            $('input[name$=_selectedobjects]:checked').each(function () { 
                $(this).prop("checked", false);
            });
            $(checkid).prop("checked", true); 
        }

    }
</code></pre>
