Unable to create checkbox
I'm trying to create checkboxes dynamically, but it's not working. I'm using following code
- ( function( $ ) {
-
- $(document).ready(function() {
- $('#services').on("change", function() {
- $('#doclist').empty();
-
- currentCat = $(this).val();
-
- data = $.parseJSON(bookingdata);
- $.each(data[currentCat], function (index, value) {
- $('<input />', { type: 'checkbox', id: value.id, value: value.name }).appendTo("#doclist");
- $('<label />', { 'for': value.id, text: value.name }).appendTo("#doclist");
- });
- });
- });
- } )( jQuery );
Its working fine when i change input type to text, radio...