html 点击 重置 单选,单选按钮上需要的Html 5不会重置(Html 5 required on radio button wil not reset)...

单选按钮上需要的Html 5不会重置(Html 5 required on radio button wil not reset)

如果选中,为什么单选按钮组上的html5不会重置表单重置按钮。 例如,如果您选择其中一个单选按钮,然后单击重置表单按钮,它不会重置单选按钮组所需的验证,即使表单已重置,您在表单中有一个带有html5必需集的单选按钮组。 所以基本上你点击提交按钮而不选择任何东西,单选按钮被赋予红色轮廓然后你选择一个然后点击重置然后你可以提交表格而不选择单选按钮? 任何有关它为什么这样做的帮助将不胜感激。 我可能会误解它应该如何工作。 简单的测试

Why won't an html5 required on radio button group reset with form reset button if it was selected. for example you have a radio button group in a form with the html5 required set if you select one of the radio buttons then click the reset form button it doesn't reset the radio button group required validation so even though the form was reset. So basically you click submit button without selecting anything the radio buttons are given an outline in red then you select one and click reset you are then able to submit the form without selecting a radio button? any help on why it does this would be greatly appreciated. I may misunderstand how its supposed to work. Simple test

原文:https://stackoverflow.com/questions/44441177

更新时间:2020-02-11 17:29

最满意答案

这是因为您使用相同的名称作为单选按钮。如果您使用相同的名称,只能检查一个单选按钮。所以它通过验证

示例:单选按钮的名称不同。

示例:单选按钮的名称相同。

It is because you are using same name for the radio buttons.If you give the same name only one radio button of the can be checked.And so it passes the Validation

Example : Different name for radio buttons.

Example : Same name for radio buttons.

相关问答

$to = 'dinefour4@gmail.com';

$subject = 'The subject';

$name = $_POST['name'];

$email = $_POST['email'];

$option = ""

if(isset($_POST['place']))

{

$option = $_POST['place'];

}

$mobile = $_POST['mobile'];

$message = <<

$name

$ema

...

代替 $("#enumCurrencyType").val(1);

尝试 $("#enumCurrencyType[value='1']").prop('checked',true);

要么 $("#enumCurrencyType[value='1']").attr('checked','checked');

编辑: - 由于EnumRadioButtonFor()生成的HTML中的id是_enumCurrencyType_HomeCurrency ,所以试试这个: - $("#_enum

...

正如你所说,没有值为“null”的单选按钮,因此可观察对象将找不到任何合适的DOM来移动checked属性。直到可观察的开发人员重写check属性如何使用null值,你可以使用jquery或这个javascript代码 检查这个道场 As you said there is no radio button with value "null", therefor observable object won't find any suitable DOM to move the checked pro

...

您可以通过赋值null来使用ngModel重置单选按钮

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值