2016년 10월 4일 화요일

[Ajax강의,jQuery강의,자바강의★탑크리에듀]jquery innerHTML 속성과 관련된 jQuery 메서드 html(), text()

innerHTML 속성과 관련된 jQuery 메서드

html(): 내용을 html 로 출력(html 태그 출력)
text() : 내용을 text로 출력(텍스트만 출력)

<script type="text/javascript">
$(document).ready(function() {
var color=["red", "orange", "purple"];
$("h1").each(function (index, item) {
//<h1>본문 내용을 출력, 출력내용 두개는 둘다 같지만
//font가 있는 내용은 text()인 경우  <font>태그 생략
alert($(item).html()); 
alert($(item).text());
});
});
</script>
<body>    
<h1>OnjSystems.co.kr</h1>
<h1>OnjProgramming.co.kr</h1>
<h1><font color="red">OracleJavaCommunity.co.kr</font></h1>
</body>
 
j8.png
j9.png

댓글 없음:

댓글 쓰기