我有两个单选按钮,每个按钮都会在表单上切换不同的输入。我已经使用onclick()
函数使用hide()
来创建这个函数,但是如果用户来回切换,这需要具有复制.show()
的另一个函数来将元素返回。认为必须有更好的逻辑,这不是多余的,也许是一个if切换值?单选按钮来改变表单输入
不管怎么说,这是我有:
<labe>
<input type="radio" name="radioReason" onClick="resetPassShow()"> </input
<span class="text">Request profile update (i.e. phone#)</span>
</label>
<label>
<input type="radio" name="radioReason" value="resetPassword" onClick="resetPassRemove;"> </input>
<span class="text">Reset Password or Unlock My Account</span>
</label>
function resetPassRemove(){
$("#prodCategoryLabel").hide();
....
}
function resetPassShow(){
$("#prodCategoryLabel").show();
....
}
您发布HTML代码搞砸了。请清理它 –