2010-01-11 3 views
0

<blockquote><p>We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply.If your question is about this website, ask it on meta instead.</p></blockquote>.jquery를 통해 런타임에서 원본 html 코드를 변경하는 방법은 무엇입니까?

위 코드를이 코드로 변경하고 싶습니다.

<blockquote> 
    <div class="quote_start"><div></div></div><div class="quote_end"><div></div></div> 
    <p>We prefer questions that can be answered, not just discussed. 
Provide details. Write clearly and simply.If your question is about this website, ask it on meta instead.</p> 
    </blockquote> 
+0

예제에서 끝내려는 코드에 결함이 있습니다 ... 두 개 이상의 div를 열면 .... –

답변

1

이 유일한 인용구이다의 첫 번째 자식 요소로 텍스트를 배치 할 앞에 추가 방법

$('blockquote').prepend('<div class="quote_start"><div></div></div><div class="quote_end"><div></div></div>'); 

를 사용? 그래서 당신이 앞에 추가를 사용할 수 있다면/

$("blockquote").prepend("<div class='quote_start'><div></div></div><div class='quote_end'><div></div></div>"); 

그렇지 않으면 당신은 앞에 추가 작업을 수행하기 전에 문제의 인용구를 식별하기 위해 어떻게든지 찾을 필요가있다.

+0

이 코드를 변경하려면 페이지의 모든 blockquote가 필요합니다. –

+0

예를 들어 jquery가 작동해야합니다. 발견 한 모든 인용구에 적용 할 것입니다. 유일한 문제는 특정 블록 쿼트를 맞추어야하는 경우입니다. – Pharabus

+0

@pharaus - @RHicke는 큰 따옴표를 사용하고 있으며 여러분은 한 명입니다. 왜 그렇게? –

관련 문제