Reputation: 1075
The element is:
<input type="text" name="idName" id="idName" value="" size="2" maxlength="2" />
I use this selector:
alert($('#idName').val());
In IE 8: cannot alert the content
In IE 9 and firefox 8: can alert the content
why? How to fix?
Upvotes: 2
Views: 91
Reputation: 195992
Make sure the code that calls the alert($('#idName').val());
is inside a $(document).ready(function(){..});
part, so that it runs after the DOM is ready..
$(function(){
alert($('#idName').val());
});
Upvotes: 3