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

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -