samedi 19 mars 2016

How to uncheck a checkbox using Javascript(closure)?

I have following code in my javascript code

goog.dom.$(changeIdStr).getElementsByTagName('input')[0].checked = false console.log(typeof(goog.dom.$(changeIdStr).getElementsByTagName('input')[0].checked) console.log(goog.dom.$(changeIdStr).getElementsByTagName('input')[0].checked); console.log(goog.dom.$(changeIdStr).innerHTML);

and the corresponding log is

boolean

false

<label><input type="checkbox"
onclick="handleSelectedUrl('selected_1_0', 'selected_', 'url_')"
name="selected[]" value="http://ift.tt/1C0ZSCP"
checked=""><a href="http://ift.tt/1C0ZSCP"
target="_blank">http://ift.tt/1MgGJpi;

So why the checked attribute is false, there is still checked="" in the HTML.




Aucun commentaire:

Enregistrer un commentaire