Ticket T698026
Visible to All Users

How to set a value to TextBox using the jQuery library

created 6 years ago

I have an DxTextBox control.I would like to know how to set value in DxTextbox via JQuery.I have tried below code but its not working…

DxView:-

HTML
<div data-options="dxView : { name: 'mTaskEntry', title: 'mTaskEntry' } " > <div data-options="dxContent : { targetPlaceholder: 'content' } " class="dx-content-background"> <div id="TxtTaskName" data-bind="dxTextBox: { }"></div> </div> </div> JS:- Task.mTaskEntry = function (params) { "use strict"; $.ajax({ type: 'GET', headers: { "Authorization": 'Bearer ' + sessionStorage.getItem("tokenKey") }, url: 'http://103.76.188.138:85/mportservice/api/TaskAssign/GetTaskAssign?CompanyID=1&TaskAssignID=' + params.id, dataType: "json", success: function (data) { alert(data[0].TaskName); $('#TxtTaskName').val(data[0].TaskName); ---------------> Here is My Code }, failure: function (data) { alert(JSON.stringify(data)); }, error: function (data) { alert(JSON.stringify(data)); } }); var viewModel = { // Put the binding properties here }; return viewModel; };

Answers approved by DevExpress Support

created 6 years ago (modified 6 years ago)

Hi Junaid,
To properly set a value for all DevExtreme editors, you need to modify the value field. From what I gather, you are using the KnockOut library in your application. To learn how to modify the value field, please check the Change Options help topic.

By the way, you can solve a lot of tasks using our documentation and the search engine, including the question you asked above. So, I would like to clarify how you are working with documentation. Do you have any particular difficulties with it? Probably we will be able to improve it further taking into account your feedback.

    Comments (2)
    JA JA
    Junaid Ahmed 3 6 years ago

      Actually I have used multi channel applications with ko library…

      Now I am going to replace ko to jQuery library…

      Pls advise the same…

      DevExpress Support Team 6 years ago

        I suggest that you review the Get and Set Options help topic to learn how to use the jQuery library.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.