Reputation: 71
Hello Everyone @ Stack Overflow, I've searched in-depth to no avail.
Background: I'm developing a web application using visual web developer express 2010, and using Bootstrap for css.
I have a text-input form control on my site for the user to enter a search query.
Problem: this text-input form control has no value or text attribute. Even when there is clearly a value/text that I am typing in.
Image of textbox and html code
I planned on my javascript changing the text in the textbox to the selection of a list-item.
If I can provide any other information or code, please let me know & I will update.
My theory is the Bootstrap JavaScript & Jquery libraries are interfering, but i haven't a clue where to start probing.
Upvotes: 1
Views: 2510
Reputation: 683
value
is an attribute on the DOM node's in-memory JavaScript representation, which has a getter that will retrieve the current value of the input
and a setter that will update it on-screen, but not in the computed page. However, the HTML attribute value
and the in-memory parameter are not kept in sync by default. That is, the computed HTML does not keep track of what the user has typed, but the value
JavaScript attribute does. You can go ahead and update your input using something like:
$(input).val(someListValueOrWhatever)
Or, de-jQuery-ified:
input.value = someListValueOrWhatever
And the element will update on-screen just fine. Bootstrap and jQuery don't interfere.
Upvotes: 4