1

SimpleTipプラグインを要素のグループに適用するときに、ツールチップテキストに各要素の属性を使用させるにはどうすればよいですtitleか?

$('td[title]').simpletip({
    content : << this element's title attribute >>
});
4

3 に答える 3

5

私はこれがあなたのために働くと思います

$('td[title]').each(function() {
    $(this).simpletip({
        content : $(this).attr('title')
    });
});
于 2009-03-19T05:40:34.123 に答える
4
$('td[title]').each(function() {
    $(this).simpletip({
        content : $(this).attr('title')
    });
});
于 2009-03-19T05:41:12.670 に答える
1

私はそれを行うためのハックを見つけました:

Simpletip ソース コードの 25 行目あたり:

// change this line:
.html(conf.content)
// to this
.html(conf.content ? conf.content : elem.attr('title'))

次に、simpletip 関数を呼び出すと、次のようになります。

$('td[title]').simpletip({
    content: false
});

ええ、それは少しハックですが、動作します。

于 2009-03-19T05:36:23.867 に答える