javascriptvisual-studio-codeemmet

Is there a way to quickly add a class to a pre-existing element in VSCode? (with Emmet Notation)


When you want to create a div with a class already applied, you can just type div.foo and VSCode will change it to be <div class="foo"></div>, but what if you want to add a class or id to an already existing element?

E.g you already have a div <div></div>, but you want to add a class called bar to it, to make it <div class="bar"></div>

Is there any way you can do this with Emmet notation, VSCode, or some other extension?


Solution

  • The best I've come up with is after <div add a space and then type cl "tab" classname.