var ArrivalCity = (data.aircraftView[0].arcftSchedList[0].tripArrivalCity);

Here the origin is a single line text box field where I am populating the value from the rest api. I am able to retrive the value in ArrivalCity. But it is not putting the data in the Origin which is a single line text field. I tried different approaches but was not able to figure out. Can anyone help me with this?

3 Answers 3


Your code (Setting the value to input field using JQuery) is correct, so try to investigate the issue as the following:

First, make sure that you have referenced the JQuery ref correctly.

Second, make sure that the title of the textbox is correct.

Third, make sure that the ArrivalCity log value console.log(ArrivalCity);

Fourth, convert the value to string ArrivalCity.toString(); at


If the Origin field is a required field, we need use the jQuery code below to set value.

$("input[title='Origin Required Field']").val(ArrivalCity);

I suggest you using IE or Chrome F12 developer tools to check this "input" html code and make sure the title name. And debug your code check if the ArrivalCity value is empty.

Or you can provide the full code for further research.

  • Can i know how can I do the same for a choice field to be populated from the same code? Commented Aug 30, 2018 at 15:21
  • Using $('select[title="Origin Required Field"]').append("<option value='"+ArrivalCity+"'>"+ArrivalCity+"</option>");
    – LZ_MSFT
    Commented Aug 31, 2018 at 1:46

Thank you for the answers. However the above code worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.