N
N
nur20502018-03-17 12:44:20
JavaScript
nur2050, 2018-03-17 12:44:20

How to manipulate dynamic elements?

Good day everyone!
There is Ajax, I write data to value, but later when I access it, it gives the initial empty value<input type="hidden" id="currency">

var currency = $('#currency').val();  // currency пустой

How to assign a value to a variable that was dynamically assigned in input?
Thanks for the help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-03-17
@sidni

Well, in general, Ajax is an asynchronous request, perhaps at the time of reading from the value from the input, it did not have time to be assigned, you need to make sure that the callback function was successfully completed.
and it is desirable to bring its text (callback functions)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question