728x90
반응형
& 이 변환되지 않고 빈문자로 출력되어서,
& 를 특정 문자열로 대체
function sanitizeFileName(fileName) {
return fileName.replace(/&/g, '_and_'); // &를 '_and_'로 대체
}
$('#example').DataTable({
dom: 'Bfrtip',
buttons: [
{
extend: 'excelHtml5',
title: sanitizeFileName('엑셀&파일명_2024')
}
]
});
728x90
반응형
'Front > JS & jQuery' 카테고리의 다른 글
[js][Echarts] stack bar 차트에서 각 막대에 다른 색상 설정하기 (0) | 2024.12.26 |
---|---|
[jquery] evt.currentTarget을 사용하여 선택된 <select> 박스의 선택된 option의 text를 가져오기 (0) | 2024.12.25 |
[js] .join("") (0) | 2024.12.21 |
[js] JavaScript에서 정수끼리의 곱셈 처리 방법 (0) | 2024.12.20 |
[js] 두 개의 정수를 곱했음에도 결과가 소수점으로 계산되는 경우 (0) | 2024.12.19 |