jQuery replaceWith 객체를 교체하기 > 개발

본문 바로가기

사이트 내 전체검색

뒤로가기 개발

jQuery replaceWith 객체를 교체하기

페이지 정보

작성자 관리자 (61.♡.24.46) 작성일 15-12-23 15:19 조회 3,918 댓글 0

본문

예제)

<div class="container">
  <div class="inner first">Hello</div>
  <div class="inner second">And</div>
  <div class="inner third">Goodbye</div>
</div>

$( "div.second" ).replaceWith( "<h2>New heading</h2>" );

<div class="container">
  <div class="inner first">Hello</div>
  <h2>New heading</h2>
  <div class="inner third">Goodbye</div>
</div>

$( "div.inner" ).replaceWith( "<h2>New heading</h2>" );

<div class="container">
  <h2>New heading</h2>
  <h2>New heading</h2>
  <h2>New heading</h2>
</div>

$( "div.third" ).replaceWith( $( ".first" ) );

<div class="container">
  <div class="inner second">And</div>
  <div class="inner first">Hello</div>
</div>

추천0

댓글목록 0

등록된 댓글이 없습니다.

전체 386건 18 페이지
게시물 검색
Copyright © Baragi.Net All rights reserved.
PC 버전으로 보기