简体   繁体   English

多项选择退订表格

[英]Multiple Choice Unsubscribe form

I'm having a bit of trouble figuring out the jquery (or javascript) syntax for an unsubscribe form. 我在确定退订表单的jquery(或javascript)语法时遇到了一些麻烦。

The project entails the following: 该项目需要以下内容:

I no longer wish to receive: 我不再希望收到:

(1) Information related to product A (1)与产品A有关的信息

(2) Information about any production from Company A1 (Company A1 also own product A) (2)有关公司A1的任何生产的信息(公司A1也拥有产品A)

(Submit) (提交)

Please keep in mind I have not been provided a field for the visitor to submit their email address. 请记住,我没有为访问者提供一个字段来提交其电子邮件地址。 Although the the user is able to opt out of using product A, if they choose to, but they will still receive emails from the Company. 尽管用户可以选择不使用产品A,但是如果他们愿意的话,他们仍然会收到公司的电子邮件。 If they choose option 2 they will be unsubscribed from all products the company provides. 如果他们选择选项2,则将取消订阅该公司提供的所有产品。

here is my html: 这是我的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>

I have not moved on to the JS. 我还没有转到JS。 I'm stuck in regards to the best approach. 我一直坚持最好的方法。 Any suggestions would be greatly appreciated. 任何建议将不胜感激。 Thanks 谢谢

give id to your form for example unscfrm then you can access the choice of user like in this example below 给您的表单输入ID,例如unscfrm那么您可以像下面的示例一样访问用户的选择

$('#unscfrm input[type=button]').click(function(event)

  {
    event.preventDefault();

    var choice=$('unscfrm').find('input:radio:checked').val();

    alert(choice);
  })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM