我必须输入单选按钮即显示编辑按钮时,单选按钮被选中
Radio1
Radio2
随着2个隐藏编辑锚链接,我写了jQuery代码对单选按钮其作品被点击时显示和隐藏编辑链接超级但是当我刷新我的网页默认情况下,第一次检查radio1时,它不会显示编辑链接,当我第二次点击它显示编辑链接。
默认情况下,如果单选按钮被选中显示编辑链接有人可以帮助我实现它谢谢!
https://jsfiddle.net/qx69o1bd/6/
的Html
<div>
<input id="radio-1" class="radio-custom rad_1" name="top_Ad" type="radio" checked>
<label for="radio-1" class="radio-custom-label" style='font-size:14px;'>Radio1</label>
<a style='display:none' href="#" class="edit1">Edit</a>
</div>
<div>
<input id="radio-2" class="radio-custom rad_2" name="top_Ad" type="radio">
<label for="radio-2" class="radio-custom-label" style='font-size:14px;'>Radio2</label>
<a style='display:none' href="#" class="edit2">Edit</a>
</div>
JQUERY
$(".rad_1").click(function() {
$(".edit1").show();
$(".edit2").hide();
});
$(".rad_2").click(function() {
$(".edit2").show();
$(".edit1").hide();
});
只是删除'风格=“显示:从第一个复选框none''(_or默认选中checkbox_ )。检查[Demo](https://jsfiddle.net/tusharj/qx69o1bd/10/) – Tushar