• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Miscellaneous / Create an element

Create an element

Create an element
var div = document.createElement('div');
var link = document.createElement('a');
var article = document.createElement('article');

Source

https://vanillajstoolkit.com/reference/dom-injection/createelement/

Miscellaneous

Related Snippets:

  • 3 Ways To Find an Object by ID in a JavaScript Array
  • How to change the value of an object which is inside an array
  • Add characters to the end of a string if it’s less than a certain length
  • What is the difference between prefix and postfix operators?

Primary Sidebar

JSON Compare

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2026 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers
Advertisement