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. Image for the cookie policy date

How i can get value in numeric textbox (ej:NumericTextBox) from JS?

How can I alert the NumericTextBox value?

<ej:Dialog ID="Dialog199" Title="Sample" runat="server">
            <br />
            Your dialog contents here 
            <br />
            <ej:NumericTextBox runat="server" ID="num1" Value="3"></ej:NumericTextBox>
            <br />
            <ej:Button runat="server" ID="button1" Text="OK" ClientSideOnClick="btnOK"></ej:Button>
            <ej:Button runat="server" ID="button2" Text="Cancel"></ej:Button>

<script type="text/javascript">

    function btnOK() {

        var dialogObj = $("#<%=Dialog199.ClientID%>").data("ejDialog");

        var num1Obj = $("#<%=num1.ClientID%>").ejNumericTextBox("instance");
        alert(num1Obj.value()); ???



1 Reply

KS Kaviyarasu Sivasenapathi Syncfusion Team August 4, 2017 12:44 PM UTC

Hi Tomer, 
Thanks for contacting Syncfusion support. 
We have analyzed your query (“Not able to get the numeric textbox value”). You can achieve your requirement by using getValue() method of “NumericTextbox” component. Please refer the below code block. 
<div id="ControlRegion"> 
    <div class="control"> 
            @Html.EJ().Button("ok").Text("OK").ClientSideEvents(evt => evt.Click("btnOK")).Width("70px").Height("30px") 
    function btnOK(args) { 
        var dialogObj = $("#basicDialog").data("ejDialog"); 
        var num1Obj = $("#numeric").data("ejNumericTextbox"); 
        alert("current value is: " + num1Obj.getValue()); 
For your convenience, we have attached the sample below.  
To know more details about getValue() method, please refer the following documentation link  
Please let us know if you need further assistance on this. 
Kaviyarasu S   

Live Chat Icon For mobile
Up arrow icon