$(document).ready(function(){ $('.tiptxt').each(function(){ //Si element existe alors on a le texte var texte = $(this).find('span').html(); if (texte!=''){ $(this).qtip( { content: { text: texte }, solo: true, style: { width: 400, classes: "ui-tooltip-cream" }, position: { at: "bottom center", my: "top center" } }); } else { $(this).qtip({ content: { text: "Chargement...", ajax: { url: $(this).find('a').attr('href')+'&q=ajax' } }, solo: true, style: { width: 400, classes: "ui-tooltip-cream" }, position: { at: "bottom center", my: "top center" } }); } }); });