在iframe元素

时间:2015-07-18 08:24:51

标签: javascript jquery wordpress mailchimp

我正在使用MailChimp弹出窗体,它提供了一个脚本标记并将其放在网站的页脚上。我在页脚的MailChimp上添加了一个链接和类。现在我想做的是,当有人点击该链接时,我想在现有元素上触发点击事件(关闭按钮)。

jQuery('body').on('click','.content__footer .nothanks', function(){
    alert('checkpoint');
    jQuery('.mc-closeModal').trigger('click');
});

我在firebug中试过这段代码没有得到任何警报。

    <body>
   <!-- content and scripts of site -->
   <script> <!-- The script given by mail chimp which adds the following HTML elements to DOM --></script>
   <div id="PopupSignupForm_0" widgetid="PopupSignupForm_0">
      <!-- MC MODAL -->
      <div data-dojo-attach-point="modalContainer" class="mc-modal" style="display: block; opacity: 1;">
         <div data-dojo-attach-point="modalClose" data-action="close-mc-modal" class="mc-closeModal">close</div>
         <div class="mc-layout__modalContent">
            <iframe frameborder="0" data-dojo-attach-point="iframeContainer" style="width: 100%; height: 316px;" scrolling="no" marginheight="0" marginwidth="0" src="about:blank">
               <html>
                  <head>
                     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
                     <link rel="stylesheet" type="text/css" href="//s3.amazonaws.com/downloads.mailchimp.com/css/signup-forms/popup/1.0/common.css" media="all">
                     <link rel="stylesheet" type="text/css" href="//s3.amazonaws.com/downloads.mailchimp.com/css/signup-forms/popup/1.0/layout-1.css" media="all">
                     <style type="text/css"></style>
                  </head>
                  <body marginwidth="0" marginheight="0">
                     <div class="modalContent" id="SignupForm_0" widgetid="SignupForm_0">
                        <div class="flash-block" data-dojo-attach-point="formResponseMessages"></div>
                        <div class="modalContent__content" data-dojo-attach-point="formContentContainer">
                           <!-- Title & Description - Holds HTML from CK editor -->
                           <div class="content__titleDescription" data-dojo-attach-point="descriptionContainer">
                              <div style="line-height: 20.7999992370605px; text-align: center;"><strong>SUBSCRIBE TO OUR NEWSLETTER</strong></div>
                              <span style="font-size:12px"><span style="font-family:verdana,sans-serif">Stay up to date with our newsletter for new releases and store promotions.</span></span>
                           </div>
                           <!-- Form Fields -->
                           <form action="//mc.us11.list-manage.com/subscribe/form-post?u=c0c090854941738a3e1d65522&amp;id=3c3311c3a7" accept-charset="UTF-8" method="post" enctype="multipart/form-data" data-dojo-attach-point="formNode" novalidate="">
                              <div class="content__formFields" data-dojo-attach-point="formFieldsContainer">
                                 <div class="field-wrapper" id="uniqName_3_0" widgetid="uniqName_3_0">
                                    <label for="mc-EMAIL">Email Address</label>
                                    <input type="text" name="EMAIL" value="" id="mc-EMAIL">
                                    <div class="invalid-error"></div>
                                 </div>
                                 <div style="position:absolute;left:-5000px;"><input type="text" name="b_c0c090854941738a3e1d65522_3c3311c3a7" tabindex="-1" value=""></div>
                              </div>
                              <div class="content__button">
                                 <input class="button" type="submit" value="Subscribe" data-dojo-attach-point="submitButton">
                              </div>
                           </form>
                           <!-- Footer - Holds HTML from CK editor -->
                           <div class="content__footer" data-dojo-attach-point="footerContainer"><a class="nothanks" href="http://javaScript:void(0);" target="_self"><span style="line-height:20.7999992370605px">No, I am not interested in free clothing</span></a></div>
                        </div>
                        <div class="modalContent__image" data-dojo-attach-point="formImageContainer"></div>
                     </div>
                  </body>
               </html>
            </iframe>
         </div>
      </div>
      <!-- MC MODAL OVERLAY -->
      <div data-dojo-attach-point="modalOverlay" class="mc-modal-bg" style="display: block; opacity: 0.1;"></div>
   </div>
</body>

您可以在此处查看网站http://goo.gl/HO7d2q

0 个答案:

没有答案