Reputation: 4224
For the following HTML
<div id='parent'>
<input id='child' type=hidden value=''/>
</div>
I am doing
$('#parent #child').val('test')
OR
$('#parent > #child').val('test')
but none of the above is working in IE7. It does work in Firefox though
Any idea why is it not working ?
Upvotes: 0
Views: 499
Reputation: 14747
Your syntax seems correct. The only stuff I can think of that can muck this up are:
$(document).ready()
block.prop()
instead of .attr()
if you're using jQuery 1.6+Upvotes: 1
Reputation: 1254
is it because you've got the HTML wrong? You should use " for attribute values. Sometimes IE is more sensitive to these things than Firefox
Upvotes: 1
Reputation: 3080
Try $('#child').val('test');
which would probably give the same result.
Upvotes: 0