【发布时间】:2014-03-15 23:21:57
【问题描述】:
如何仅在表单验证时调用函数?
我的提交按钮在按下时会打开一个模式,但即使表单没有验证它也会这样做。如何将模态绑定到验证方面,以便模态仅在表单有效时显示?
HTML:
<head>
<script src="js/additional-methods.js"></script>
<script src="js/jquery-validate.min.js"></script>
<script src="js/modalEffects.js"></script>
<div class="md-modal md-effect-16" id="modal-16">
<div class="md-content">
<h3>Thank you for signing up!</h3>
<div>
<p>We're excited to have you onboard as launch in late July.</p>
<ul>
<li><strong>Read:</strong> Check your email. Make sure you're subscribed to the email list.</li>
<li><strong>Surprise:</strong> Thanks for believing in us. As a gesture of thanks, you're getting the first batch of $50 giftcards to use on VERSEUX.</li>
<li><strong>Share:</strong> There are still some giftcards left. Share them with your friends, family, and fashionistas.</li>
</ul>
<button class="md-close">Close me!</button>
</div>
</div>
</div>
<div class="md-overlay"></div><!-- the overlay element -->
<script src="js/classie.js"></script>
<script src="js/modalEffects.js"></script>
JS 和 CSS 代码很长,所以它在小提琴
【问题讨论】:
-
您的 JSFiddle 链接无效,请重新检查您的网址,谢谢
-
他忘了加js JSfiddle
-
这不是您的另一个问题的重复,stackoverflow.com/questions/22430839/… 吗?
标签: javascript jquery forms jquery-validate