/DOM-Code-Snippets

The repo for VSCode "DOM Code Snippets" extension.

DOM Code Snippets

Features

This extension contains a set of code snippets for getting / creating DOM elements.


Installation

In order to install an extension you need to go to the extension tab or launch the Command Palette (Ctrl + Shift + P or Cmd + Shift + P) and type Extensions.

There you have either the option to show the already installed snippets or install new ones. Search for DOM Code Snippets and install it.


Supported languages (file extensions)

  • JavaScript (.js)
  • TypeScript (.ts)
  • Vue (.vue)
  • JavaScript React (.jsx)
  • TypeScript React (.tsx)

Snippets

Below is a list of all snippets. The means the TAB key.

Getting elements

Trigger Content
gid→ const var = document.getElementById('id')
dqs→ const var = document.querySelector('selector');
dqa→ const var = document.querySelectorAll('selector');
dce→ const var = document.createElement('element');

Future plan

As soon as I find myself needing a new snippet, I will add it to this extension.

Also, any suggestion is welcomed!