문제

I have between 1 and 10 tags in my code which require a jquery ui tooltip to be added.

the a tags all have a class of tool

the a tags all have a title attribute which contains what I want to appear in the tooltip.

My question is how do I iterate over the a tags

ie

$( ".tool" ).tooltip({ content: });

Struggling to get my head around this one - can anyone help me with the logic / code required? Because there can be more than one, I am slightly confused.

What might make it slightly more confusing, is that the tags are all entered into the page via ajax .load

Thanks in anticipation for any help which can be given.

도움이 되었습니까?

해결책

Try this.

    $('.tool').tooltip({
      content: function() {
        var element = $( this );
        return 'content';
        //return element.attr( "title" ); //or like this
      }
    });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top