javascript로 렌더링 할 때 html의 구조/구조를 어떻게 바꿀 수 있습니까? 상위 div를 제거하고 그것의 속성과 클래스 이름 을 자식 요소에 복사하고 싶습니다. 하지만 특정 클래스 이름을 포함하는 전체 페이지에서이 작업을 수행하려고합니다. 코드 예제에서동적으로 HTML 요소를 변경하고 자바 스크립트로 속성을 복사하는 방법
:
이<div class="someblock" class="abc" myid="123" position="2">
<p>Some paragraph</p>
<img width="140px; height: 140px; class="myimg" src="url to imgage" />
</div>
이 사람이이, 또는 jQuery를 자바 스크립트와 함께 할 수있는 방법을 알고 있나요 :이 코드
<div class="abc" myid="123" position="2">
<div class="someblock">
<p>Some paragraph</p>
<img width="140px; height: 140px; class="myimg" src="url to imgage">
</div>
로 변경해야합니까? 미리 감사드립니다.,
Chris.
jQuery.attr'의 무리()'jQuery.unwrap'다음()'. –