jQuery(function($) { setTimeout(function() { var $top = $("html body"); $top.find('[class~="data"]').each(function() { var help = $(this).attr('data-help'), type = $(this).attr('data-type'), xpath = $(this).attr('data-xpath'), tag = $(this).attr('data-tag'), output = ""; if (help) { output += "Help: " + help + "
"; } if (type) { output += "Type: " + type + "
"; } if (xpath) { output += "
" + "" + "show xpath
" + xpath + "

"; } if (output.length > 0) { output = "
" + output + "
"; } $(this).qtip({ content: { title: "" + tag + "", text: function () { var div = $(output); div.find(".xpath-link") .click(function() { var xpath = $(this).next(); if (xpath.is(":hidden")) { xpath.show(); $(this).text("hide xpath"); } else { xpath.hide(); $(this).text("show xpath"); } return false; }); return div; } }, hide: { fixed: true, delay: 300 }, style: "qtip-tipped" }); }); }, 0); });