【问题标题】:How to change checkbox label dynamically in Gravity form如何以重力形式动态更改复选框标签
【发布时间】:2017-04-20 09:19:13
【问题描述】:

我使用重力表单 WordPress 插件创建了一个多页表单。我创建了一个复选框,并且在选中和取消选中该复选框时需要显示不同的标签。 我已经将 JQuery 用于单页表单, 但在多页表单中它不起作用。 有什么合适的方法吗

【问题讨论】:

标签: php jquery wordpress gravity-forms-plugin multipage


【解决方案1】:

多页面重力形式加载其他页面而不重新加载整个网页, 因此,如果编写 jQuery 可能无法识别表单的隐藏部分。 所以我们可以使用

jQuery(document).bind('gform_post_render', function() {});

在表单页面加载后触发我们的 jQuery 函数。

参考:https://www.gravityhelp.com/documentation/article/gform_post_render/

【讨论】:

    【解决方案2】:

    试试这个

        jQuery(document).bind('gform_post_render', function(){
    
            // destroy default Gravity Form datepicker
            jQuery("#your_id").datepicker('destroy');
    
            // create new custom datepicker
            jQuery("#your_id").datepicker({ defaultDate: '+7d', minDate: '+7d', gotoCurrent: true, prevText: *, showOn: 'both', buttonImage: '/wp-content/plugins/gravityforms/images/calendar.png', buttonImageOnly: true });
    
        });
    
    </script>
    

    【讨论】:

      猜你喜欢
      • 2020-12-08
      • 2021-06-24
      • 2017-05-09
      • 2021-03-07
      • 2015-06-12
      • 1970-01-01
      • 2016-04-29
      • 2018-07-06
      • 1970-01-01
      相关资源
      最近更新 更多