Top 10 Mind-Blowing JavaScript Tricks You’ve Never Seen Before
JavaScript is one of the most effective tools for development of the inspiring and very close-to-life internet sites. This is due to, on one hand, versatility and, on the other, availability of numerous ways to create a piece of code to perform a set of tasks. In this conversation we take a closer look at the following 10 mind-blowing JS code tricks you’ve probably never seen before. In fact, learning these tips will blow your mind and how you code will be revolutionized!
Dynamic HTML content with the InnerHTML property
The InnerHTML property makes it possible to write another HTML on the same HTML at runtime. A way of inserting content into an element instead of document.createElement and its content child node appendage is by just setting the new html content to internalHTML. Oh, and you know exactly what, it finally makes it incredibly easy for YOU to change the content of an element without to have to fiddle with the DOM itself.
< pre >
< script >
document.getElementById('targetElement').innerHTML = '< h1 >New Heading< /h1 >';
< /script >
< /pre >
Generating Unique IDs with UUID
Creation of identifiers can be challenging conducting business with large database or when creating…