美文网首页
2018-09-29 编写cpc联调项目的页面时使用label

2018-09-29 编写cpc联调项目的页面时使用label

作者: 五大RobertWu伍洋 | 来源:发表于2018-10-13 22:35 被阅读10次
<form name="FinalAccept" method="get" action="accept"><br>
<input id="rYes" type="radio" name="YesNo" value="Yes" onclick="this.form.submit();">
<label for="rYes">Yes</label><br>
<input id="rNo" type="radio" name="YesNo" value="No" onclick="this.form.submit();">
<label for="rNo">No</label><br>
</form>

label 的 for属性指定到 input 的 id 名称,这样点击label就可以选中radio的选项了!

onclick 用得好也可以显著提高用户体验,只不过为了安全,我去掉了,使用了统一的submit。

相关文章

网友评论

      本文标题:2018-09-29 编写cpc联调项目的页面时使用label

      本文链接:https://www.haomeiwen.com/subject/mxhioftx.html