$('#dynamic_field2').append('<input type="text" class="form-control pull-right datepicker" data-inputmask="'alias': 'date'" name="reg_bdate" data-mask placeholder="Birth Date">');
单击该按钮时,它应附加在dynamic_field2 div中,但它会给我这个错误
我无法弄清楚如何解决这个问题。
答案 0 :(得分:1)
$('#dynamic_field2').append('<input type="text" class="form-control pull-right datepicker" data-inputmask="'alias':'date'" name="reg_bdate" data-mask placeholder="Birth Date">');
您的引号未转义,或者您试图插入变量
正确的引号:
$('#dynamic_field2').append('<input type="text" class="form-control pull-right datepicker" data-inputmask="\'alias\':\'date\'" name="reg_bdate" data-mask placeholder="Birth Date">');
变量:
$('#dynamic_field2').append('<input type="text" class="form-control pull-right datepicker" data-inputmask="'+ alias +':'+ date +'" name="reg_bdate" data-mask placeholder="Birth Date">');