Pergunta

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...

Foi útil?

Solução

You can set the title as an attribute

$('.anchor').attr('title', str);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top