We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get value from textarea

Thread ID:

Created:

Updated:

Platform:

Replies:

144576 May 13,2019 06:32 AM UTC May 29,2019 10:38 AM UTC Vue 3
loading
Tags: TextBox
sayali saitawdekar
Asked On May 13, 2019 06:32 AM UTC

How to get value from textarea? id attribute is not appended to textarea.


Ashokkumar Balasubramanian [Syncfusion]
Replied On May 13, 2019 10:19 AM UTC

Hi sayali saitawdekar, 
 
Greetings from Syncfusion support. 
 
You can get the textarea value from the component using component vue reference as mentioned in the below code example. 
 
<template> 
    <div id="app"> 
        <ejs-textbox ref="textareaObj" :created="onCreate" id="default" :multiline="true" :value="value" floatLabelType="Auto" placeholder="Enter your name"></ejs-textbox> 
    </div> 
</template> 
 
<script> 
    import Vue from "vue"; 
    import { TextBoxPlugin } from '@syncfusion/ej2-vue-inputs'; 
    Vue.use(TextBoxPlugin); 
    export default { 
        data() { 
            return { 
                value: "Syncfusion" 
            } 
        }, 
        methods: { 
            onCreate: function (args) { 
                let value = this.$refs.textareaObj.value; 
                alert(value); 
            } 
        } 
    } 
</script> 
 
<style lang="scss"> 
    @import "../node_modules/@syncfusion/ej2-base/styles/material.css"; 
    @import "../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css"; 
</style> 
 
 
Please let us know, if you have any concern. 
 
Regards, 
Ashokkumar B. 


sayali saitawdekar
Replied On May 27, 2019 09:06 AM UTC

What if i want the value of textbox, when user enters value in a textbox?

Ashokkumar Balasubramanian [Syncfusion]
Replied On May 29, 2019 10:38 AM UTC

Hi sayali saitawdekar, 
 
You can get the updated value of TextBox component using change event argument. Please find the below code block. 
 
Note: Change event triggered when the value changed in textbox (After focus out the input) 
 
<ejs-textbox ref="textboxObj" :change="changeValue" placeholder="First Name"></ejs-textbox>   
  
  methods:{ 
    changeValue:function(args){ 
        console.log(args.value); 
    } 
  } 
 
Also, we can able to get the value of TextBox using component reference. Please refer the below code block. 
 
<ejs-textbox ref="textboxObj" :change="changeValue" placeholder="First Name"></ejs-textbox> 
 
methods:{ 
    changeValue:function(args){ 
        console.log(this.$refs.textboxObj.ej2Instances.value); 
    } 
  } 
 
Please check the provided code block and get back to us, if you need any further assistance. 
 
Regards, 
Ashokkumar B. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon