I am trying to change the class of a element with Javascript using the below code:
parent.document.getElementById('<?php echo $markid ?>').class = 'unlistened';
Not having much luck though. How do I do this properly?
.className rather than .class
Use .className
instead of .class
Class is a reserved word in JS so it's changed to className. A few other HTML attributes are changed in a similar way. "for" changes to "htmlFor" for instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With