2011/1/18 Diego Perini <[email protected]>: >> $('#my-check-box').attr('checked', true); -> should work cross browser if >> it is a checkbox. >> >> and you can check if a checkbox is checked by using >> `$('#my-check-box').is(':checked')`... >> > > these two $() statements alone deserve a long chapter by themselves to > exactly explain all the inconsistencies that may arise by using them > together (probably even for checkboxes).
I'm aware of the DOM properties vs. HTML attributes problem in general but could you please elaborate the inconsistencies in this specific case. What jQuery actually does here is elem['checked'] = true (cf. line 1749 of jQuery 1.4.4) and elem.checked === true (cf. line 3573). That's the recommended way, isn't it? Regards Mathias -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
