I have a function called by a link that should check the various flags that exist inside a specific div (passed to the function). Works in all browsers except IE (7.) As far as I can tell .attr ('checked', 'checked' is the right way to do this with jquery 1.5.1
function selectall(industry){ $("#"+industry+"Apps :checkbox").attr('checked', 'checked'); $("#"+industry+"Apps :checkbox").change(); }
Is there something I'm missing, or is there a better way to do this that works in all browsers? I donโt care what you donโt choose, just choose.
HTML looks like
<div id = 'HealthcareApps'> <div style="clear: both;"> <a href = "javascript:selectall('Healthcare');">Select all</a> </div> <ul> <li><label for="id_Healthcare_0"><input type="checkbox" name="Healthcare" value="1" id="id_Healthcare_0" /> Simple Messaging</label></li> <li><label for="id_Healthcare_1"><input type="checkbox" name="Healthcare" value="2" id="id_Healthcare_1" /> Mobile Alerts and Alarms</label></li> <li><label for="id_Healthcare_2"><input type="checkbox" name="Healthcare" value="3" id="id_Healthcare_2" /> Patient Identification / Drug Conflicts</label></li> </ul>
(yes, I know that inline styles are a terrible idea. I will fix this if I can ever get this link to work in IE.)
nando source share