2017-05-29 108 views
0

我有參考使用;在JavaScript中使用nbsp從  in script is not getting compiled但它仍然無法爲我工作。javascript u00Ao無法正常工作

$(document).ready(function(){ 
    var addButtonn = $('.add_rescuer'); //Add button selector 
    var wrapperr = $('.field_rescuer'); //Input field wrapper 
    var fieldHTMLL = '<div data-role="dynamic-fields"><div class="form-inline"><div class="form-group" id="txtboxToFilter"><label for="instansi"><font color="white">Instansi yang Terlibat:</font></label> \u00A0\u00A0\u00A0 <input type="text" class="form-control" name="rescuer[]" placeholder="Masukkan Kegiatan" required size="92"/></div> <a href="javascript:void(0);" class="remove_rescuer btn btn-danger btn-xs" title="Hapus Kegiatan"><i class="fa fa-fw fa-minus"></i></a></div></div></div>'; //New input field html 
    var y = 1; //Initial field counter is 1 
    $(addButtonn).click(function(){ //Once add button is clicked 
     y++; //Increment field counter 
     $(wrapperr).append(fieldHTMLL); // Add field html 
    }); 
    $(wrapperr).on('click', '.remove_rescuer', function(e){ //Once remove button is clicked 
     e.preventDefault(); 
     $(this).parent('div').parent('div').remove(); //Remove field html 
     y--; //Decrement field counter 
    }); 
}); 

當我試圖運行該代碼時,它沒有改變任何東西。問題是什麼 ? \ u00A0沒有正常工作。

+0

試試這個:'\ ua0' – zer00ne

+0

當我改變\ u00A0到\ UA0,在同時其他功能不起作用。 :( – Unknown

回答

0

在這種字體顏色的問題,我認爲這是白顏色: 供大家參考 https://codepen.io/kalaiselvan/pen/ybWxxW

$(document).ready(function(){ 
    var addButtonn = $('.add_rescuer'); //Add button selector 
    var wrapperr = $('.field_rescuer'); //Input field wrapper 
    var fieldHTMLL = '<div data-role="dynamic-fields"><div class="form-inline"><div class="form-group" id="txtboxToFilter"><label for="instansi"><font color="black">Instansi yang Terlibat:</font></label> \u00A0\u00A0\u00A0 <input type="text" class="form-control" name="rescuer[]" placeholder="Masukkan Kegiatan" required size="92"/></div> <a href="javascript:void(0);" class="remove_rescuer btn btn-danger btn-xs" title="Hapus Kegiatan"><i class="fa fa-fw fa-minus"></i></a></div></div></div>'; //New input field html 
    var y = 1; //Initial field counter is 1 
    $(addButtonn).click(function(){ //Once add button is clicked 
    y++; //Increment field counter 
    $(wrapperr).append(fieldHTMLL); // Add field html 
    }); 
    $(wrapperr).on('click', '.remove_rescuer', function(e){ //Once remove button is clicked 
    e.preventDefault(); 
    $(this).parent('div').parent('div').remove(); //Remove field html 
    y--; //Decrement field counter 
    }); 
});