Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LaraBABA's avatar

html inside a textarea issue with Vue js

Hi all,

Imagine this textarea

<textarea v-model="message">
<p>Mycontent here<br>Hello</p>
</textarea>

At the moment when my v-model passes data from an axios response, the html looks like text. Do you remember how to get the html to actual act as html with the V-model and textarea please?

Thank you

0 likes
8 replies
MohamedTammam's avatar
Level 51

@User476820 No, you need to have another element for v-model. Like

<textarea v-model="rawHtml"></textarea>
<div v-html="rawHtml"></div>
LaraBABA's avatar

@MohamedTammam The biggest problem I am encountering is that it is fine, the text response goes into v-html but if the user wishes to type more text or correct it, it will not work because this is a DIV and not a textarea. Tricky...

LaraBABA's avatar

@MohamedTammam Ok found a solution with contentEditable= "true", then add an input method which rewrite the changes inside the given array. Cool :-)

Please or to participate in this conversation.