Hello, I have a problem, I need to add a color to a text that is added inside a textarea with a button.
I've tried using x.style.color="red" "... But it did not work, if anyone has a solution please introduce me.
Follow the code:
<body>
<textarea name="texto" id="texto">
</textarea>
<button class="button button2" type="button1">Texto</button>
<script>
var textarea = document.querySelector('textarea');
var button1 = document.querySelector('button');
var assinatura1 = 'TEXTO COLORIDO'
button1.addEventListener('click', function() {
textarea.value += assinatura1;
});
</script>
</body>