2011-04-26 3 views
0

나는 같은 HTML 구조를 가지고 그리고이 문제에 대한 접근?jQuery를 변경 HTML 구조는 동적으로

편집 질문 완전한 데이터가 당신은 내가 사업부 내부 인 (앵커 태그의 첫 번째에 qtip을 설정하려면 참조 그렇다면 포맷팅 및

<div class="fullcalendar-event"> 
     <h3 class="title"><a href="/saasmax/trunk/isv-events/test-event">Test Event</a></h3> 
     <div class="fullcalendar-instance"> 
     <a href="/saasmax/trunk/isv-events/test-event" field="field_e_date" allDay="1" start="2011-04-25" end="2011-04-25" index="0" eid="184" entity_type="node" cn="fc-event-default isv_events node-type-isv_events" title="Test Event" class="fullcalendar-event-details" editable=""><span class="date-display-single">Mon, 04/25/2011</span></a> </div> 
    </div> 

다음이다

fullcalender. 내가 필요 필요

모든 데이터는

헤더 툴팁의에 표시한다는 것입니다 div fullcalendar-instance의 앵커 제목이되어야합니다. 툴팁에 표시하는

텍스트는 앵커 태그에 링크 할 수 있습니다. 나는 당신의 업데이트에 따라 내 대답을 편집 한

+0

어디에서 데이터를 가져 옵니까? 새로운 요소에 대한 데이터를 의미합니다. 그것은 일정합니까? – kapa

+0

새로운 데이터의 내용은 동적입니다. 나는 가져올 정확한 데이터를 알려주기 위해 제 질문을 편집 할 것입니다. – ayush

+0

먼저 내 대답에서 주어진 코드를 시도해보십시오. 특정 요구에 맞게 변경하십시오. 여전히 문제가 발생하면 기꺼이 도와 드리겠습니다. – kapa

답변

1

(모두 DIV 년대에 동일하다). 나는 당신을 완전히 이해한다고 말하지 않지만,이 코드는 그 일을해야합니다.

$(document).ready(function() { 
    //access to whole div 
    var $fe=$('.fullcalendar-event'); 
    //access to H3 
    var $fe_title=$('h3.title', $fe); 
    //creating qtip-tooltip SPAN 
    var $tooltip_span=$('<span class="qtip-tooltip" />') 
          .text($('.fullcalendar-instance a', $fe).attr('title')); 
    //wrapping H3 in SPAN and adding tooltip before it 
    $fe_title 
     .wrap('<span class="qtip-link" />') 
     .before($tooltip_span); 

    /* I am unsure if you want to change HREF, uncomment if yes 
    //access to the link in the H3 
    var $fe_title_link=$('a', $fe_title); 
    //creating new HREF 
    var newhref='/saasmax/trunk/'+$fe_title_link.attr('href'); 
    //setting HREF for link 
    $fe_title_link.attr('href', newhref); 
    */ 
}); 

나는 또한 jsFiddle을 만든, 그래서 당신은이 일어나고 확인하고 필요한 경우 조정할 수 있습니다.

+0

편집 된 질문을보고이 제목과 데이터를 동적으로 설정하는 방법을 제안 할 수 있습니까? – ayush

+0

@ayush 시도해보고 필요하면 원하는 것을 분명히하십시오. – kapa

관련 문제