Created
September 24, 2020 20:37
-
-
Save lamegaton/f9bd7bd7d9969bfd8049985dec53df05 to your computer and use it in GitHub Desktop.
Example of getElements
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
Tools | |
</br> | |
<label for="axe">axe</label> | |
<input type="checkbox" class="tools" name="tools" id="axe" value="axe"></br> | |
<label for="axe">bow</label> | |
<input type="checkbox" class="tools" name="tools" id="bow" value="bow"> |
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
var inputByName = document.getElementsByName("tools"); | |
var inputByClass= document.getElementsByClassName("tools"); | |
inputByClass[0].onclick = function(){ | |
console.log(inputByClass[0].checked); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment