This line of code is working fine for Firefox
$("#<%=txt1.ClientID%>").text()
but not for IE8 and IE7. See the scenario below in order to understand what I really mean:-
Scenario:-
- Loading .aspx page.
- populating text box with some data from database.
- Now user changes data in same text-box at client-side (means page not yet submitted) So here in firefox, the above line of javascript is showing me the actual data came from database, but IE7&8 showing me the changed data. But I want actual data.
So i need some compatible code for IE7 & IE8
I hope i explained it well what i need. Thanks in advance
What’s
txt1? Is it an<input>?Use
input.value, or in jQueryval(), to read the value of a form field.text()reads textual content inside an element, which for most form fields is nothing.For a
<textarea>the textual content will be the initial contents of the field as in the source HTML file, not the current value of the field. (These initial contents correspond to the DOMdefaultValueproperty, notvalue. In an<input>, this is thevalue="..."property instead of textual content, but it’s stilldefaultValuein the DOM and notvalue.)