이미지 제목에 아스키 문자 참조 (®
)를 사용하는 데 문제가 있습니다. 그것은 html 본문을 통해 설정할 때 잘 작동하지만 javascript를 통해 동일한 작업을 수행하려고하면 작동하지 않습니다.js를 사용하여 img title 속성에 ascii 참조를 설정할 수없는 이유는 무엇입니까?
확인 sscce :
<style type="text/css">body {background-color:black;}</style>
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
<p>this image has the correct ascii character title:<br /><img src="http://www.prototypejs.org/images/logo-home.gif" id="img1" title="®" /></p>
<p>but why can't I set the same value via javascript?<br /><img src="http://www.prototypejs.org/images/logo-home.gif" id="img2" /></p>
<script type="text/javascript">
$("img2").title = "®";
</script>
감사합니다.
참조 http://stackoverflow.com/questions/5890175/is-it-not-possible-to-use-html-entities-in-a-title-attribute – simshaun
아, 이해할 것 같습니다 .. 거기에 있습니다. 어디서나 'htmlToText'유틸리티 기능? html 요소를 프로그래밍 방식으로 작성하여 텍스트를 추출해야하는 것을 싫어합니다. – pstanton