Vue.js convert string to lowercase


We can use native javascript function to convert string to lowercase. Here in this article we are going to explain how you can use toLowerCase() function to convert string to lower case. You can also use our online editor to edit and run the code online.


Vue.js convert string to lowercase Example

You can convert string to lower case simply as below-

Example:

<div id="app">	
	<p>{{myStr}}</p>
	<p>{{myStr2}}</p>
	<button @click="myFunction()">Click Me</button>
</div>
<script>
 new Vue({
el: '#app',
  
  data: { 
	  myStr:"Hello World!",
	  myStr2:""
  },
  
   methods:{
    myFunction: function () {	
		this.myStr2 = this.myStr.toLowerCase();
    }
   }

});
</script> 

Try it »

Output of above example-

Vue.js convert string to lowercase Example

Advertisements

Add Comment

📖 Read More