javascript - How can I get the value from text field in a Fancybox iframe on closing -


I have a quiz in a fancy box (2) iframe, when I have completed a number in the hidden text box Page in Fancybox:

  & lt; Form & gt; & Lt; Input type = "text" id = "theresult" hidden = "true" /> & Lt; / Form & gt;  

Now when the user closes the Fancybox, I need to capture this value for the use of the oriented page, I've tried:

  $ ('$ input:' theresult '); ($ width: 800, height: 500, first off: function () {var testResult = $ ("# fancybox-frame"). #txtTestValue') Attr ('value', testResult);}});  

But it gives "[commodity object]" ...

What am I doing wrong ?!

Since you are using the fancybox v2.x Em> selector , so try it

  beforeClose: function () {var testResult = $ (".fancybox-iframe"). material (). ("#Theresult"). Val (); $ ('# TxtTestValue') Attr ('value', testResult);  

Notice changes:

  $ ("# fancybox-frame")  
< P> ... should be

  $ (".fancybox-iframe")  

... and I've also added Val ( ) method.


Comments