jQuery UI Tooltip with dynamic content

前端 未结 4 798
再見小時候
再見小時候 2021-01-22 13:20

I use jQuery UI Tooltip Widget and there is code:

  $(function() {$( document ).tooltip({  
    content: \'connecting\',
    content:function(callback) {
                


        
4条回答
  •  星月不相逢
    2021-01-22 13:34

    I think it's best to use HTML5 custom attribute

    Alex Brown
    John Black

    and script

    $(function() {
        $( ".teacher" ).tooltip({
           content: function() { return $(this).attr('data-id'); },
        });
    });
    

    You can play with this at: http://jsfiddle.net/pT3ed/4/

    Just replace "return $(this).attr('data-id');" with your loader using $(this).attr('data-id') as id.

提交回复
热议问题