简体   繁体   中英

How to get form field from iframe using jquery

I'm using fancybox 2 to open an iframe that displays some inputs as checkbox like:

<input type="checkbox" id="contact" name="sector" value="cellular">

now I want that when the user clicks on the fancybox title a parent function will be called with the all checkbox values.

this is my fancybox title:

'<li onclick="parent.sendIframeDataToParent(document.getElementByType("checkbox"), "sector_hook");">Submit</li>'

and I'm getting this error: Uncaught SyntaxError: Unexpected token }

What am I missing?

The " in your JavaScript terminates the HTML attribute you delimit with " . Giving you:

onclick="parent.sendIframeDataToParent(document.getElementByType("

When you have " as data in an attribute value delimited with " , represent them as &quot; .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM