how can i do when some option is checked in checkbox, that label showing in select tag?
Checkbox input
<input
type="checkbox"
class="toggle-product pull-right" @if(!isset($restrictedProductIds[$p->id])) checked
@endif
data-url="">
Select tag
<select name="default_id" id="default_id" class="form-control">
<option value="" selected></option>
@foreach($validProducts as $product)
@if(!isset($restrictedProductIds[$product->id]))
<option value="">
</option>
@endif
@endforeach
</select>
class .toggle-product
$(".toggle-product").on('click', function () {
var checked = $(this).is(':checked');
var $status = $(this).parents(".list-group-item");
$status.addClass('list-group-item-warning');
$.post($(this).data('url'), {
'enabled': checked ? 1 : 0,
'_token': ""
}, function (response) {
$status.removeClass('list-group-item-warning');
//location.reload();
}.bind(this))
});
via Arturs Jerjomins