감안할 때 htmls : 이제JQuery와에 현재 선택한 요소의 outerHTML에 활용하는 방법을
<div id="t">
<a class="xx">xx</a>
<a class="yy">yy</a>
<a class="zz">zz</a>
</div>
어떻게 그 클래스 xx
또는 zz
있는 링크를 얻으려면, 그게 내가 얻고 싶은 말의에 대해 이 :
<a class="xx">xx</a>
<a class="zz">zz</a>
:
$("#t a").each(function(){
if($(this).is(".xx,.yy"){
//here how to get the out the HTML of the current a element?
}
});
어떤 대안을?
두 가지 대답이 있지만 나는 그들이 오해하고있는 것 같습니다.
$("#t a").each(function(){
if($(this).is(".xx,.yy"){
//here I want to get the full HTML of the `a` element
// That's to say, I want to get `<a class="xx">xx</a>`
// I can not use $(this).html() or $(this).text() which will only return the `xx`.
}
});
내 업데이트 된 답변 확인 –
http://stackoverflow.com/questions/2419749/get-selected-elements-outer-html – rahularyansharma