jQuery get data-parent value -
i have checkboxes when 1 of them checked returns value stored in data-parent
the html:
<input type="checkbox" name="" data-parent="some-parent">
the jquery:
$(document).on('change', '.checkbox', function(event) { alert($(this).data(parent)); });
here returns [object object]
you need quote parent
:
$(document).on('change', '.checkbox', function(event) { alert($(this).data("parent")); });
single quotes fine.
Comments
Post a Comment