문제

I have a string variable, str, that changes every time the user checks a box in a drop-down options menu. it contains all the values that are currently checked. I applied the text in the str variable to a div element like this: the html:

                <div class="anchor" style="width:165px; white-space: nowrap; overflow:hidden;" title= "">Everyone</div>

the jquery:

            $('.anchor').text(str);

this works. now, what i would like to do is to have the string in the variable str (which is the list of checked items) appear as hover text when i hover over the div. how can i go about that? doing title ="str" or title = str obviously doesn't work...

도움이 되었습니까?

해결책

You can set the title as an attribute

$('.anchor').attr('title', str);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top