Javascript 使用自定义图像单选按钮时,使单选按钮成为必需的
我的问题是,我正在为我的单选按钮使用自定义图像,所以我将它们设置为显示:无;但这样做意味着他们不再被要求出动 有没有简单的解决办法?单选按钮必须是图像 -谢谢Javascript 使用自定义图像单选按钮时,使单选按钮成为必需的,javascript,css,radio-button,Javascript,Css,Radio Button,我的问题是,我正在为我的单选按钮使用自定义图像,所以我将它们设置为显示:无;但这样做意味着他们不再被要求出动 有没有简单的解决办法?单选按钮必须是图像 -谢谢 <label for="topsides">Top Sides</label> <form action="" id="TopSideYearCubics_id"> <input class="radio" id="topsidescubicsides" type="radio" name="p
<label for="topsides">Top Sides</label>
<form action="" id="TopSideYearCubics_id">
<input class="radio" id="topsidescubicsides" type="radio" name="properties[Top Sides]" value="Cubic Sides" required="required">
<a id="topsidescubicsides_button" href="javascript:set_radio('topsidescubicsides');" class="radio-picture-150x150" style="background: url(http://www.xxxx.com/_Store/_images2015/customring_buttons/button_CA01test_topsides_cubics.gif) no-repeat scroll 0 0;"> </a>
<input class="radio" id="topsidesyearsides" type="radio" name="properties[Top Sides]" value="Year Sides">
<a id="topsidesyearsides_button" href="javascript:set_radio('topsidesyearsides');" class="radio-picture-150x150" style="background: url(http://www.xxxx.com/_Store/_images2015/customring_buttons/button_CA01test_topsides_years.gif) no-repeat scroll 0 0;"> </a>
</form>
<br />
<script>
<!-- //## Sets the Image to the Radio Button ##//-->
function set_radio($inputid) {
$("input#" + $inputid).click();
}
$(document).ready(function() {
$("a.radio-picture-150x150").click(function(){
var $id = $(this).attr('id');
$("a.radio-picture-150x150").removeClass('selected-border');
$("a#" + $id).addClass('selected-border');
});
});
</script>
<style>
input[type=radio], input[type=checkbox] {
display:none;
}
</style>
在我的CSS中,我只是给输入[type=radio]一个不透明的样式:0;若要取消stock按钮,但仍显示浏览器的,请在未选择我的自定义收音机图像时选择以下选项之一验证工具提示。使用伪元素显示:无仍然意味着所需选项将不起作用。输入[type=radio][required]{位置:绝对;左:-10000px;}?