I have a quiz in a fancybox(2) iframe, when complete I have a score held in a hidden text box on the page within the Fancybox:
<form>
<input type="text" id="theresult" hidden="true"/>
</form>
Now when the user closes the Fancybox, I need to capture this value for the parent page to use, I have tried:
$('.fancybox1').fancybox({
width: 800,
height: 500,
beforeClose: function () {
var testResult = $("#fancybox-frame").contents().find('input#theresult');
$('#txtTestValue').attr('value', testResult );
}
});
But this returns "[object Object]"...
What am I doing wrong?!