I’m trying to user a DOM element that i am saving into a JS var:
lastCheckBoxChecked = this;
“this” represents a input/checkbox DOM element.
Now, trying to get if the checkbox is checked from the element with:
if(lastCheckBoxChecked.getAttribute('checked') == true)
doesn’t work.
When I checked what does lastCheckBoxChecked holds, I found out that in IE9 it holds Object and when writing
alert(lastCheckBoxChecked.getAttribute('checked'))
I am getting the correct value but in firefox and chrome it holds
object HTMLInputElement and there is no functionality (getting undefined).
I don’t know if this is the reason I am not getting anything, but this is my direction.
Does any one know any thing about this?
Please, just use this:
Not:
getAttributechecks for the initial state of the checkbox, or if it was changed withgetAttributeonly. User operations have no effect on it.