weixin_33696106 2015-08-11 14:21 采纳率: 0%
浏览 21

一页上有3种重力形式

I'm currently displaying three gravity forms on a page, "display:none;", and setting them to "block" when one of the three corresponding buttons are clicked.

You can view the example on http://b2bsauce.com/

The problem is that on validation, the AJAX part reloads, with the error messages and again displays the form as hidden, which obviously, in this case, does not make sense.

Is there any way I can hook into the validation process and set the form to display or should I have gone about this in another way?

JS

var form = jQuery(this).attr('href');
jQuery('.gform_wrapper').not(form).css('display','none');
jQuery(form).slideDown();

HTML

Each form is contained in this wrapper, which is set to "display:none".

<div class="gf_browser_chrome gform_wrapper" id="gform_wrapper_1" style="display: block;">
</div>

<div class="gf_browser_chrome gform_wrapper" id="gform_wrapper_2" style="display: block;">
</div>

<div class="gf_browser_chrome gform_wrapper" id="gform_wrapper_3" style="display: block;">
</div>
  • 写回答

2条回答 默认 最新

  • weixin_33712881 2015-08-11 14:25
    关注

    Submit buttons don't have the href attribute (assuming that's what is being clicked), are you trying to get the action of the form or just save the form instance itself to a variable?

    I think you are trying to save the form element to a variable so I would change your code to:

    var $form = jQuery(this).parents('form'); // use $ prefix to show it's a jQuery object
    jQuery('.gform_wrapper').not($form).css('display','none');
    jQuery($form).slideDown(); // not sure if you need this line if the form is already showing
    

    but I'm not sure if that's all you need or not without some sort of self contained example that can be edited.

    评论

报告相同问题?

悬赏问题

  • ¥15 Pwm双极模式H桥驱动控制电机
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题