多项选择退订表格

Multiple Choice Unsubscribe form

本文关键字:表格 选择      更新时间:2023-09-26

我在弄清楚取消订阅表单的jquery(或javascript)语法时遇到了一些麻烦。

该项目需要以下内容:

我不再希望收到:

(1) 与产品A相关的信息

(2) A1公司

的任何生产信息(A1公司也拥有产品A)

(提交)

请记住,我没有为访问者提供提交其电子邮件地址的字段。尽管用户可以选择不使用产品A,如果他们选择,但他们仍然会收到来自公司的电子邮件。 如果他们选择选项 2,他们将取消订阅公司提供的所有产品。

这是我的 HTML:

<p class="text">Unsubscribe</p>
<p>I no longer wish to receive:</p> 
<form> 
     <input type="radio" name="choice1" value="choice1" />Information related to product A <br /> 
     <input type="radio" name="choice2" value="choice2" />Information about any product from Company A<br /> 
     <input type="button" value="submit" />
</form>

我还没有转到JS。我被困在最好的方法上。任何建议将不胜感激。谢谢

例如为您的

表单提供 id,unscfrm然后您可以访问用户的选择

$('#unscfrm input[type=button]').click(function(event)
  {
    event.preventDefault();
    var choice=$('unscfrm').find('input:radio:checked').val();
    alert(choice);
  })