그래서 사이트가 있으며 편집 할 요소를 분리하기 위해 작업 할 클래스가 있습니다. html 내에서 특정 문자열을 포함하는 요소를 찾아서 형제 html 중 하나를 대체해야합니다. 여기문자열을 포함하고 형제 요소를 대체하는 요소를 찾음
if((".user.info").html().indexOf(vaUID[index]) >= 0) {
$("a.user.info").each(function (index2, obj) {
if($(this).html().indexOf(vaUID[index]) >= 0) {
$(this).siblings('.registered').html('<div class="registered"><a href=http://www.twitch.tv/'+users[index]+ '>currently streaming' + data.stream.game + '</a></div>');
}
});
}
시작 HTML 것 : 어쨌든, 여기에 내가있어 코드입니다
내가 함께 결국 원하는 것은<div class="user first">
<div class="element_avatar simple small "><a href="http://www.cnr-clan.com/profile/xxxxxx" data-minitooltip="username"><img src="http://assets-cloud.enjin.com/users/xxxxxx/avatar/small.xxxxxx.png"></a></div>
<div class="info">
<a href="http://www.cnr-clan.com/profile/xxxxxx" class="element_username tag-xxxxxx">username</a>
<span class="nameicons">
<!--Irrelevant Excess Code-->
</span>
<div class="registered">currently browsing</div>
</div>
<div class="clearing"><!-- --></div>
</div>
: 나는이 점을 명심
<div class="user first">
<div class="element_avatar simple small "><a href="http://www.cnr-clan.com/profile/xxxxxx" data-minitooltip="username"><img src="http://assets-cloud.enjin.com/users/2219573/avatar/small.xxxxxx.png"></a></div>
<div class="info">
<a href="http://www.cnr-clan.com/profile/xxxxxx" class="element_username tag-xxxxxx">username</a>
<span class="nameicons">
<!--Irrelevant Excess Code-->
</span>
<div class="registered"><a href='http://www.twitch.tv/username'>currently streaming gamename</a></div>
</div>
<div class="clearing"><!-- --></div>
</div>
같은 클래스로이 같은 몇 개의 코드 블록. vaUID [index]의 예제 값은 xxxxxx입니다.
올바른 트랙에 나를 설정해 주셔서 감사합니다. 지금이 코드를 js로 가져 왔지만 여전히 문제가있는 것 같습니다. $ '('a.element_username 사용자 .INFO. ') \t .filter (함수() { \t \t $ 리턴 (본) .html 중에서() 같이 IndexOf (vaUID [인덱스])> -1]. \t}) \t .siblings ('DIV') \t .html 중에서 ('streaming ' + data.stream.game + '');'내가 사용자 ID를 더빙 href 속성의 마지막 몇 개를 선택하여 올바른 요소를 찾으려면 – superzilla
. 이 코드는에 중첩되어 있습니다.사용자 ID (vaUID [index])를 반복하는 각 명령문, 예를 들어 xxxxxx) 및 twitch.tv 사용자 이름 (사용자 [index]) – superzilla