2012-11-30 2 views
2

buttonset의 각 라디오 버튼에 툴팁을 추가하는 표준 방법이 있습니까?JQuery UI ButtonSet 툴팁

<span id="tools"> 
    <input type="radio" id="feature1" name="tool" title="feature 1"><label for="feature1">Tool 1</label> 
    <input type="radio" id="feature2" name="tool" title="feature 2"><label for="feature2">Tool 2</label> 
</span> 

및 스크립트 :

$('#tools').buttonset(); 

는 이미 각 입력에 대해 제목을 추가 한하지만 어떤 도구 설명이 없습니다.

답변

5

당신은 jQuery를하고 각 레이블 속성에 대한이 올바른지에 의존하는 모든 것을이

$(function() { 
    ​$('label').each(function() { 
     var radio = $(this).prop('for')​​​​​​​​; 
     $(this).prop('title',$('#' + radio).prop('title')); 
    }); 
}); 

같은 것을 사용할 수 있습니다.

+0

감사합니다. 그게 내가 찾고 있던거야! – Coffka

0

레이블에 제목 속성을 간단히 옮길 수 있습니다.

+0

그리고 라디오 버튼 주위에 라벨을 감 쌉니다. –