When I use this code, it doesn't want to work.
$('[id$=ADRESTextBox]').text(data[0]);
The data is an array as you can see. It really has a value (because I alerted it) How do you fill a certain textbox with jQuery.
jQuery val() Method The val() method returns or sets the value attribute of the selected elements. When used to return value: This method returns the value of the value attribute of the FIRST matched element.
To get a form value with jQuery, you need to use the val() function. To set a form value with jQuery, you need to use the val() function, but to pass it a new value.
Set values of form elements with val()
:
$('[id$=ADRESTextBox]').val(data[0]);
If you are talking about text input
elements: They don't have "content" anyway. It is a single, self-closing tag, so any attempt to put something inside the tag will fail. A text field's value is defined by its value
attribute.
Update:
With respect to the comment: If ADRESTextBox
is actually the full ID, use $('#ADRESTextBox')
to select the element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With