MyBB Community Forums

Full Version: jQuery tooltips
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, trying to implement a jQuery tooltip hover code on my forum, but I can't get it to support multiple tooltips in a single post without breaking. I tried adding an ID parameter but I don't know how to jet the JS to recognise it.


\[tip id=(.*?) content=(.*?)\](.*?)\[/tip\]

<span id="tip-$1" title="$2">$3</span>

And the very simple JS in headerinclude:


  <script type="text/javascript">
  $(function() {
    $("#tip").tooltip();
  });
  </script>
How would I go about this?
Use a mask in your script:
<script type="text/javascript">
 $(function() {
   $("[id^=tip-]").tooltip();
 });
 </script>

Edit
You can use a class too:
Search:
\[tip content=(.*?)\](.*?)\[/tip\]

Replacement:
<span class="tip" title="$1">$2</span>

JS:
<script type="text/javascript">
$(function() {
   $(".tip").tooltip();
});
</script>