-1
I am structuring an experimental system where when clicking a button it copies what is selected (in this case a snippet in html) as the below:
<section>
<h1> titulo </h1>
<p>texto desta área</p>
</section>
<button>Modificar código</button>
Then he would make a change to the code by inserting the tags that need to be inserted (for my need)
[[bloco]]
[[repetir]]
<section>
<h1> titulo </h1>
<p>texto desta área</p>
</section>
[[/repetir]]
[[/bloco}}
Do I need to use regex? Is there any way to do this just by copying the content, changing and pasting without using regex?
Do you already have part of the code ready? It would help if you post; Since you will change "before" and "after" of the copied code, just concatenate the content:
textoAntes + textoCopiado + textoDepois
.– LipESprY
Please read Why Regex should not be used to handle HTML?. If it is a very specific html structure, Regex can be used. But if it is to generalize to multiple sites, it is not recommended.
– danieltakeshi
Document.getelementby..(). hinnerhtml helps you copy, you just have to put an id or class in the tag you want. After that, the "..." replaces with id or classname and us () puts the id or class name.
– user179340