Created
October 6, 2020 20:18
-
-
Save townivan/70195464a6335dae4468fcb0ec4a45c2 to your computer and use it in GitHub Desktop.
a function to set an attribute with JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sestAttrib(el_id, el_attr, el_value){ | |
if (document.getElementById(el_id)){ // if element exists | |
document.getElementById(el_id)[el_attr] = el_value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment