Topalian JavaScript Createelement Shorter Method by Christopher Topalian
Topalian JavaScript Createelement Shorter Method by Christopher Topalian
JavaScript
createElement
Shorter
Method
by
Christopher Andrew Topalian
<!-- https://github.com/ChristopherTopalian --
>
<!--
https://github.com/ChristopherAndrewTopalia
n -->
<!--
Topalian_createElement_Shorter_Method.htm
l -->
<style>
body
{
padding: 10px;
background-color: rgb(50, 50, 50);
font-size: 25px;
color: rgb(255, 255, 255);
}
div
{
padding-top: 10px;
}
</style>
<script>
// document.getElementById shortcut
function ge(whichId)
{
let result =
document.getElementById(whichId);
return result;
}
// document.createElement shortcut
function ce(whichType)
{
let result =
document.createElement(whichType);
return result;
}
// document.body.append shortcut
function ba(whichElement)
{
let result =
document.body.append(whichElement);
return result;
}
function showText(whichText)
{
// if element exists
if (ge("theTextDiv"))
{
// remove the element
ge("theTextDiv").remove();
}
//-//
</script>
<body>
<button onclick = "showText('Hydrogen');"> H
</button>
</body>
</html>
True Artificial Intelligence System
16-Gon
Tautology
MI 1111 CI
1101 1011
AND XNOR
0001 1001
LP RP
0011 0101
OR NOR
0111 1000
RC LC
1010 1100
XOR NAND
0110 1110
CNI MNI
Contra-
0100 0010
-diction
0000
For More Tutorials:
CollegeOfScripting.weebly.com
CollegeOfScripting.wordpress.com
Youtube.com/ScriptingCollege
Twitter.com/CollegeOfScript
GitHub.com/ChristopherTopalian
GitHub.com/ChristopherAndrewTopalian
Sites.google.com/view/CollegeOfScripting
Dedicated to God the Father
This book is created by the
College of Scripting Music & Science.
Always remember, that each time you write a script
with a pencil and paper, it becomes imprinted so
deeply in memory that the material and methods are
learned extremely well.
When you Type the scripts, the same is true. The
more you type and write out the scripts by keyboard
or pencil and paper, the more you will learn
programming!
Write and Type every example that you find.
Keep all of your scripts organized.
Every script that you create increases your
programming abilities.
SEEING CODE, is one thing,
but WRITING CODE is another.
Write it, Type it, Speak It, See It, Dream It.
CollegeOfScripting.weebly.com