I have the following html:
<html>
<head></head>
<body>
<form>
<input id="msg" type="text" value="oldValue" />
</form>
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script>
$().ready(function() {
var m = $("#msg");
alert(m.val()); // returns oldValue
m.val("newValue"); // this doesn't make the browser show newValue instead of oldValue
alert(m.val()); // returns newValue
// and in the end, the browser still shows oldValue for the input
});
</script>
</body>
</html>
This code runs perfect, but when placed in a facebox (which just creates an iframe and shows it like a floating window), the code fails to update the input’s content.
The parent also has jQuery, but that shouldn’t influence anything I guess.
Any ideas why it’s failing?
Unable to replicate on Firefox 3, IE 7 or Chrome 2. The code works fine (using
newValueeverywhere appropriate) regardless of whether it’s in an iframe.Have you tested your reduced sample implementation, as opposed to your original? Because I suspect we have a problem where you think they’re equivalent and they aren’t.
Of course, the good news is that if your posted sample implementation works, then all you have to do is add in elements from your actual implementation until something breaks.