Created
March 1, 2017 21:38
-
-
Save misraX/ad1cdfc4bf05381de250720b99d0635a to your computer and use it in GitHub Desktop.
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 showElementsOnClient(elements){ | |
// Select Elements. | |
var selectedElements = document.querySelectorAll(elements); | |
// looping through the querySelectorAll NodeList[selectedElements_lenght] | |
for (i in selectedElements){ | |
// defining selectedElements into the countedElements | |
var countedElements = selectedElements[i].innerText; | |
// checking if the countedElements are not undefined | |
if (typeof countedElements != "undefined"){ | |
// write the defiend countedElements | |
document.write("<p>" + "Pargraph innerText is: " + countedElements + "</p>" + "</br>"); | |
} | |
else{ | |
// throw the undefined values | |
console.log("can't read undefined value"); | |
} | |
// end for | |
} | |
// end function | |
} | |
// calling the function | |
showElementsOnClient("elements") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment