Jquery 检查图像上的输入收音机单击
这是我的HTML:Jquery 检查图像上的输入收音机单击,jquery,html,image,radio-button,Jquery,Html,Image,Radio Button,这是我的HTML: <img src="img.jpg" class="img-ms-form"> <div class="radio"> <label class="radio"><input type="radio" name="optradio-1" required>Option 1</label> </div> 但这似乎不起作用,我做错了什么?使用.next()和.find(),如图所示:- $('.im
<img src="img.jpg" class="img-ms-form">
<div class="radio">
<label class="radio"><input type="radio" name="optradio-1" required>Option 1</label>
</div>
但这似乎不起作用,我做错了什么?使用.next()
和.find()
,如图所示:-
$('.img-ms-form').click(function(){
$(this).next('div.radio').find('input[type="radio"]').prop('checked', true);
});
使用.next()
和.find()
,如图所示:-
$('.img-ms-form').click(function(){
$(this).next('div.radio').find('input[type="radio"]').prop('checked', true);
});
$('.img ms form')。单击(函数(){
$(this).next().find('input[type=radio]').prop('checked',true);
});代码>
选择1
我试图检查单选按钮,如果图像被点击。以下是我尝试过的:
$('.img ms form')。单击(函数(){
$(this).next().find('input[type=radio]').prop('checked',true);
});代码>
选择1
我试图检查单选按钮,如果图像被点击。以下是我试过的:
对不起,我迟到了。只需使用纯HTML即可,您可以使用以下方法:
选择1
对不起,我迟到了。只需使用纯HTML即可,您可以使用以下方法:
选择1
@onerkript happy coding mate:)@onerkript happy coding mate:)也看看我的方法。不要求接受但不使用JavaScript更好<代码>:D
也看看我的方法。不要求接受但不使用JavaScript更好<代码>:D
方法确实不错,但这会把我的css搞砸。谢谢你的意见。@onerkript-Sure…:DNice方法确实如此,但这会弄乱我的css。谢谢你的意见。@onerkript-Sure…:D