I have this code below which works fine but seems unnecessary as it loops through all div.test even if i never mouse over them. I tried putting the .qTip() function inside the mouseover event to be more efficient but that doesn't seem to work.
Any suggestions on how to make the below code more efficient?
<script type="text/javascript">
$(document).ready(function () {
$('div.test').each(function () {
var tooltipHtml = $(this).next('.tooltip').html();
$(this).qtip({
content: {
text: tooltipHtml
},
style: { width: 450 }
});
});
});