Created
August 30, 2017 20:11
-
-
Save vadym-martsynovskyy-hs/c50981868eb955769c7ab5c045d298ab to your computer and use it in GitHub Desktop.
This file contains hidden or 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 getSingleElementByClassName(className) { | |
return document.getElementsByClassName(className)[0]; | |
} | |
function replaceInnerInClass(className, text) { | |
var theClass = getSingleElementByClassName(className); | |
theClass.innerHTML = ''; | |
theClass.appendChild(document.createTextNode(text)); | |
} | |
function appendTextToClass(className, text) { | |
getSingleElementByClassName(className).appendChild(document.createTextNode(text)); | |
} | |
function replaceTextInClass(className, text) { | |
replaceInnerInClass(className, ''); | |
appendTextToClass(className, text); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment