문서의 이전 판입니다!
The after() method inserts specified content after the selected elements.
after() 메소드는 선택된 요소의 뒤에 특정 내용을 삽입한다.
<div class="container"> <h2>Greetings</h2> <div class="inner">Hello</div> <div class="inner">Goodbye</div> </div>
$( ".inner" ).after( "<p>Test</p>" );
결과
<div class="container"> <h2>Greetings</h2> <div class="inner">Hello</div> <p>Test</p> <div class="inner">Goodbye</div> <p>Test</p> </div>
The before() method inserts specified content in front of (before) the selected elements.
before() 메소드는 선택된 요소의 앞에 특정 내용을 삽입한다.
The append() method inserts specified content at the end of the selected elements
append() 메소드는 선택된 요소의 끝(자식 요소)에 특정 내용을 삽입한다.
<h2>Greetings>/h2> <div class="container"> <div class="inner">Hello</div> <div class="inner">Goodbye</div> </div>
$('.inner').append('<p>Test</p>');
결과
<h2>Greetings>/h2> <div class="container"> <div class="inner"> Hello <p>Test</p> </div> <div class="inner"> Goodbye <p>Test</p> </div> </div>
The prepend() method inserts specified content at the beginning of the selected elements.
prepend() 메소드는 선택된 요소의 시작(자식 요소)에 특정 내용을 삽입한다.