Skip to content
Advertisement

How to append element using vue js

I have variable array of objects, one of which is contains element p in the string. And I want to append to element div.profile-description

But the result is vue js return raw html to div.profile-description

I want to p in the string become element in html

JavaScript
JavaScript

Advertisement

Answer

You need use the v-html directive:

JavaScript

Alert:

Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to XSS vulnerabilities. Only use HTML interpolation on trusted content and never on user-provided content. https://v2.vuejs.org/v2/guide/syntax.html#Raw-HTML

Advertisement