Vue v-text Directive


Example

Using the v-text directive to overwrite the existing text inside a paragraph.

<div id="app">
  <p v-text="pText">Old text.</p>
</div>
Try it Yourself »

Definition and Usage

The v-text directive is used to update the text in an element.

When updating text in an element with the v-text directive, any existing text and child elements will be replaced by the new text.

Note: If you want to update just a part of a text inside a tag, consider using text interpolation {{ }} instead.


Related Pages

Vue Tutorial: Text Interpolation


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.