var content = document.getElementById('content').innerHTML; // html 안에 'content'라는 아이디를 content 라는 변수로 정의한다.

var splitedArray = content.split(' '); // 공백을 기준으로 문자열을 자른다.
var linkedContent = '';
for(var word in splitedArray)
{
  word = splitedArray[word];
   if(word.indexOf('#') == 0) // # 문자를 찾는다.
   {
      word = '<a href=\링크>'+word+'</a>'; 
   }
   linkedContent += word+' ';
}
document.getElementById('content').innerHTML = linkedContent;

 

사용예제 : 

http://codepen.io/eond/pen/MwZOzz

http://codepen.io/eond/pen/dowdWq

http://codepen.io/eond/pen/jPXaMa

이온디

profile
이온디는 라이믹스를 비롯한 다양한 CMS의 시드뱅크를 꿈꿉니다. 여러분들이 사랑하는 웹소스를 언제든지 사용할 수 있게 하기 위해 이온디는 매일 소스코드를 유지보수하고 있으며, 언제든지 다운로드할 수 있는 소스마켓을 운영하고 있습니다.

#XE마켓 - 이온디스토어
https://eond.com/xemarket/

# XE/라이믹스 단톡방을 운영 중입니다. (비번: 2022)
https://open.kakao.com/o/giaKKnl

# XE/라이믹스 생활코딩 모듈 강좌입니다.
https://opentutorials.org/module/3774