It can be very frustrating to manually surround an existing piece text, e.g.
click me, with an HTML tag such as
<a> in IntelliJ IDEA.
When you open a tag in front of the text you want to enclose, IDEA typically closes that tag right away, which is not what you want:
This leaves you to either
Ctrl-V the closing tag to its intended location or delete it and manually add it after the text again.
Select the text
click me in your editor and hit
Ctrl-Alt-T which opens the Surround With Live Template selection, where Surround With <tag></tag> in HTML/JSP should be preselected. Hit
Enter and you will get
<>click me</> with the cursor inside the opening
<>. As you type the tag name the closing tag will be added as well: