views:

20

answers:

2

In IE7 only onselecting selectall checkbox only one checjbox gets selected on firefox this works fine..How can this be fixed

   <input type='checkbox' id='selectall' name='selectall' class='selectall' onclick='javascript:selectall1();' /><label><b>Select all</b></label><br>
      <input type="checkbox" id="m_q" name="m_q" value="485">
       select country
      <input type="checkbox" id="m_q" name="m_q" value="486">Select state

<script>
function selectall1()
{
 if ($('#selectall').attr('checked')) {
    $("#m_q:not([disabled='disabled'])").attr('checked', true);
  }
 else{
  $("#m_q:not([disabled='disabled'])").attr('checked', false);
 }

}
 </script>
+1  A: 

You should not be using the same id on two different elements.

dionyziz
ya got it thanks......
Hulk
A: 

You've used the same 'id' for two of the checkboxes. This is wrong. IDs are supposed to be unique on any given page, so there's no reason to expect multiple elements with the same ID to be processed.

Marc B