How to replace string in Vue JS?

By Hardik Savani | December 7, 2018 | Category : Vue.JS

In example, i will show you how to replace string in vuejs. we will replace string using jquery replace function. we will use jquery code replace function to replace word form string in vue.js.

Below simple example to replace string "Welcome to" into "Welcome to". It is a very simple and basic, so you can easily understand it.


<!DOCTYPE html>



<title>How to replace string in Vue JS? -</title>

<script src=""></script>



<div id="app">

<div id="myId" ref="myId">{{ message }}</div>

<button @click="myFunction()">Click Me</button>



<script type="text/javascript">

new Vue({

el: '#app',

data: {

message:"Welcome to"



myFunction: function () {

this.message = this.message.replace("", "");






I hope it can help you...

Tags : Vue.JS

Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: