text()를 이용한 html 제거
2020.05.05
홈페이지를 제작하다보면 DB상에 있는 컨텐츠의 값을 가져올때 해당 내용안의 모든 html 태그 ex) h1, a, p, span등을 가져올 경우가있다. 물론 상황에 따라 다르긴하지만 가져온후에 html를 제거하는법에 대해 생각해보다가 jquery의 text를 통해서 간단하게 삭제할수있어서 포스팅 해둔다. 일단은 text() 함수는 https://api.jquery.com/text/ .text() | jQuery API Documentation Description: Get the combined text contents of each element in the set of matched elements, including their descendants. Unlike the .html() method, ..