Reputation: 55
I want to show a button if checkbox gets checked and if not checked button will not appear in laravel 5.4. How can I do this.
Upvotes: 1
Views: 3719
Reputation: 360
Or you can verify if checkbox is checked in BackEnd
if($request['checkBoxName'])
return "Checkbox is checked";
else
return "Checkbox is not checked";
Upvotes: 0
Reputation: 820
you can do this by using jquery
$('#checkbox').change(function(){
if($('#checkbox').is(':checked')){
console.log("asdad");
$('#button').css('display','inline');
}else{
$('#button').css('display','none');
}
})
Upvotes: 1
Reputation: 215
Suppose you html
<input type="checkbox" name="checkbox" id="checkbox">
In front-end you can check using jQuery
if ($('#checkbox').is(':checked')){
//
}
In back-end you can check using:
if (isset($request->checkbox) {
//
}
Upvotes: 3