[英]Can I use more than one name attribute in HTML tag?
我正在做一个 django 项目。
但我希望将单选按钮分组以及按钮名称与 django 一起使用。
可以在一个 HTML 标签中使用两个名称属性吗?
如果我这样做,我会面临任何错误吗?
下面是我陷入困境的代码。
<input type="radio" name="group1" name="removePunc"> Remove Punctuations
<br>
输入name
属性必须唯一才能使用传统形式发送数据。 如果您发现自己需要更多属性,请使用data-
属性。 请分享一些代码以了解您要实现的目标。
如果要标记单选按钮组,请将class="group1"
添加到所有单选按钮,而不是name="group1"
。
<label for="removePunc">Remove Punctuations</label>
<input type="radio" class="group1" name="removePunc">
<label for="button2">Button 2</label>
<input type="radio" class="group1" name="button2">
<label for="button3">Button 3</label>
<input type="radio" class="group1" name="button3">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.