I've got this on form
HTML
<td>
<div class="checkbox checbox-switch switch-info">
<label>
@if ($value->active == '1')
<input type="checkbox" name="play" checked="">
<span></span>
@else
<input type="checkbox" name="play">
<span></span>
@endif
</label>
</div>
</td>
Javascript
$(document).ready(function(){
$(document).on('change','.main td checkbox',function (e)
{
console.log('success');
e.preventDefault();
var element = $(this);
updateData(element);
})
});
But there is nothing 'success' in console. Script is connect correctly because another event works correctly.
checkbox
isn't an element as your selector suggests. For your selector, you want to select the attribute oftype
with a value ofcheckbox
, and to do so it would look like this:As seen you place the attribute key and value in brackets (value is optional, but in your case it is needed).