How to override attributes for javascript form widget

问题: I am attempting override 2 attributes from an existing javascript form widget on my page and am not quite sure how to go about it: I want to redirect to a different U...

问题:

I am attempting override 2 attributes from an existing javascript form widget on my page and am not quite sure how to go about it:

  1. I want to redirect to a different URL upon form submission.
  2. I need to push a data point to the end system with the id='prospects_referral_type' upon form submission

Here's the website where the form widget currently exists: https://jabzboxing.fitness/arcadia

This is the script for the widget:

<script src="https://widgets.healcode.com/javascripts/healcode.js" type="text/javascript"></script>

<healcode-widget data-type="prospects" data-widget-partner="object" data-widget-id="8423870a150" data-widget-version="0"></healcode-widget>

回答1:

I think this is what you are asking for.

To update where the form gets posted:

jQuery('form[id^=prospect_form').attr('action', 'http://stackoverflow.com')

To add an additional field:

jQuery('form[id^=prospect_form').append('<input id="prospects_referral_type" type="hidden"/>')

Keep in mind, this code has to run after the form is loaded, but it doesn't have to be on submit.

  • 发表于 2019-02-19 21:55
  • 阅读 ( 72 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除