Last active
August 29, 2015 14:21
-
-
Save rolandovillca/8fd7d7302ab3c19905af to your computer and use it in GitHub Desktop.
DOM HTML PARSING TIPS
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
$(".txtClass") => getElementsByClassName() | |
$("#childDiv2 .txtClass") => getElementById(), then getElementsByClassName() | |
$("#childDiv2 > .txtClass") => getElementById(), then iterate over children and check class | |
$("input.txtClass") => getElementsByTagName(), then iterate over results and check class | |
$("#childDiv2 input.txtClass") => getElementById(), then getElementsByTagName(), then iterate over results and check class | |
//Example: | |
$('.txtClass'); | |
$('#childDiv2 .txtClass') | |
$('#childDiv2 > .txtClass') | |
$('input.txtClass') | |
$('#childDiv2 input.txtClass') | |
var obj = document.getElementById("childDiv"); | |
xxx = obj.getElementsByClassName("txtClass"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment