Vue.Js set textarea Value


You can set textarea Value in Vue.JS using v-model, you can also set default value of textarea.


Vue.Js set textarea Value JavaScript Example

Here is an example of textarea with default value.

Example:

<!DOCTYPE html>
<html>
<head>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script>
</head>
<body>
<div id="app">
   <h1>TextArea</h1>
   <textarea v-model="myTextarea" placeholder="add multiple lines"></textarea>
</div>
<script>
 new Vue({
  el: '#app',
  data: {
    myTextarea: ['Hello World!'] 
  }
 });
</script>        
</body>
</html>

Try it »

Output of above example-

Vue.Js set textarea value example

Advertisements

Add Comment

📖 Read More