카테고리 없음

[HTML] html 페이지에서 표 작성기 기호 시각화

행복을전해요 2021. 2. 20. 17:26

pre태그 내부에서 작업하기 때문에 할 수있는 스타일링의 양에 제한이 있습니다 . 를 사용 .replace()하여 사전 코드의 공백과 탭을 다음과 같이 바꿀 수 있습니다 .

$('pre').each(function() {
    var content = $(this).html();
        content = content.replace(/ /g, '.').replace(/\t/g, '----');
            $(this).html(content);
            });
            

JSFiddle : http://jsfiddle.net/RExZL/3/



출처
https://stackoverflow.com/questions/22079938