如何在Laravel中使用JQuery/JavaScript检查复选框

如何在Laravel中使用JQuery/JavaScript检查复选框,javascript,jquery,laravel,Javascript,Jquery,Laravel,我有一个带有按钮的表单,在单击时添加新问题。每个问题都有多个答案,我想有一个复选框来表明它是否是正确的答案 登记 @csrf {{{(“问题”)} @如果($errors->has('question')) {{$errors->first('question')} @恩迪夫 {{{{('Options')} @如果($errors->has('option1')) {{$errors->first('option1')} @恩迪夫 @如果($errors->has('option2')) {

我有一个带有按钮的表单,在单击时添加新问题。每个问题都有多个答案,我想有一个复选框来表明它是否是正确的答案


登记
@csrf
{{{(“问题”)}
@如果($errors->has('question'))
{{$errors->first('question')}
@恩迪夫
{{{{('Options')}
@如果($errors->has('option1'))
{{$errors->first('option1')}
@恩迪夫
@如果($errors->has('option2'))
{{$errors->first('option2')}
@恩迪夫
@如果($errors->has('option3'))
{{$errors->first('option3')}
@恩迪夫
@如果($errors->has('option4'))
{{$errors->first('option4')}
@恩迪夫
添加
{{{(“问题”)}
@如果($errors->has('question'))
{{$errors->first('question')}
@恩迪夫
{{{{('Options')}
@如果($errors->has('option1'))
{{$errors->first('option1')}
@恩迪夫
@如果($errors->has('option2'))
{{$errors->first('option2')}
@恩迪夫
@如果($errors->has('option3'))
{{$errors->first('option3')}
@恩迪夫
@如果($errors->has('option4'))
{{$errors->first('option4')}
@恩迪夫
去除
以下是用于附加每个问题的JQuery部分:

$(函数(){
$(“.btn成功”)。单击(函数(){
var html=$(“.clone”).html();
$(“.increment”)。在(html)之后;
});
$(“body”)。在(“click”、“.btn danger”功能上(){
$(this.parents(“.control group”).remove();
});
});

单选按钮可以解决您的问题吗?或者您必须使用复选框??我对其中任何一个都很在行,我只需要解决我的问题,然后使用单选按钮。单选按钮将解决您选择一个答案的问题。是的,它对一个字段有效,但当我使用jquery添加另一个问题时,上面提到的哪个问题不起作用检查问题的答案。