문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 | 다음 판 양쪽 다음 판 | ||
javascript:commonfunctions [2012/06/25 18:13] kwon37xi |
javascript:commonfunctions [2012/06/27 16:57] kwon37xi |
||
---|---|---|---|
줄 3: | 줄 3: | ||
<code javascript> | <code javascript> | ||
function escapeHtml(str) { | function escapeHtml(str) { | ||
- | if (jQuery !== undefined) { | ||
- | // Create an empty div to use as a container, | ||
- | // then put the raw text in and get the HTML | ||
- | // equivalent out. | ||
- | return jQuery('< | ||
- | } | ||
- | |||
- | // No jQuery, so use string replace. | ||
return str | return str | ||
.replace(/&/ | .replace(/&/ |