모든 태그 제거 하고 문자열만
페이지 정보
본문
모든 태그 제거 하고 문자열만
| 소스예제 |
|---|
Remove all tag
test
모든 태그 제거하고 문자열만 |
Tag And Script
<div id="ex_test"> <div>Remove all tag</div> <span>test</span> </div> <strong>모든 태그 제거하고 문자열만</strong> <div class="div_demo-ex_tag"></div>
<script>
var oriText = $('#ex_test').html();
var newText = oriText.replace(/(<([^>]+)>)/ig,"");// 태그를 제거하기 위한 정규표현식으로 모든 태그를 제거합니다.
$('.div_demo-ex_tag').text(newText); // 모든 태그 제거하고 문자열만
console.log(newText);
</script>
추천
0
비추천
0
- 이전글 본문에서 이미지를 제외하고 추출 23.04.17
- 다음글 한글 가상키보드 23.04.10
