6

how is insert value data success: function(data)... in into tag input->value <input type="text" name="number" id="number" value=""> with jQuery?

Example: jsfiddle - my code

2 Answers 2

12
success: function(data) {
    $('#number').val(data);
}
Sign up to request clarification or add additional context in comments.

2 Comments

i want insert in value="" -> value="data"
If you mean set the value to "data", then it would be $('#number').val('data') instead.
3

Try this

success: function(data) {
    $('#number').val("value = " + $('#number').val().replace("placeholder", data));
}

2 Comments

i want insert in value="" -> value="data"
thanks, if input have placeholder, how remove placeholder and insert data in value=""?

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.