adding a tag when a button is clicked : <p>I need a script when the selected text is surrounded by tags after clicking on the button. For example, there was the text</p>

<blockquote>
  <p>This is my text, I love read</p>
</blockquote>

<p>I selected "my text" and then clicked on the button, and this text becomes surrounded by tags, for example</p>

<blockquote>
  <p>This is &lt; myTag >my text&lt; /myTag >, I love read</p>
</blockquote>

<p>The principle of operation is the same as that of text editors, when you can change fonts and style of the text, but I need to surround the text with my tag. How can I do it?</p>
