Javascript Tooltip / Posts /

How do I display multiple tooltip onload

20

I hava form the displays X icons for empty fields submitted and I want to show tooltip messages on the X icons. I am using this code and nly the last button works... What am I doing wrong?

 

<script type="text/javascript">
//launch toltip error messages.
tooltip.pop("ico_frm_error_01", "<h3>Hi</h3>, there");
tooltip.pop("ico_frm_error_02", "<h3>Hi</h3>, there");
tooltip.pop("ico_frm_error_03", "<h3>Hi</h3>, there");
</script>

Antar  6 years ago   viewed: 8669    

6 Answers

3
Did you:
1) Put the script at the end of the page, just before the </body> tag?
2) Are you sure the "ico_frm_error_01" is the rendered actual ID of the field? 
milo   6 years ago
3

Yes I tried that. The button ids are unique and are rendered exactly just like mentioned above. Only one will fire...

Example:

<img src="/media/images/gui/icons/ico_32_error.png" name="ico_frm_err_03" width="32" height="32" class="datainput_icons" id="ico_frm_err_03">

Another example (same outcome):

<img src="/media/images/gui/icons/ico_32_error.png" name="ico_frm_err_03" width="32" height="32" class="datainput_icons" id="ico_frm_err_03" onLoad="tooltip.pop(this, 'Invalid CAPTCHA code.<br>Please enter the code you see in the picture.<br>This helps us verify that you are not an automated program.')">

I tried using the methods above but only one onload funstion will fire. I even wrapped the same code in a jquery $(document).ready(function() and I am getting the same outcome. Almost every other on event works fine like mouseover and click, but not onload. I tried putting the same commands onload on one line in the body tag and the same outcome again! This is driving my nuts.

hamada
  6 years ago
0
There will be only one tooltip active at a time. You can consider put all your message #1 - #3 into one tooltip, or make the tooltips open at different time by using the setTimeout function.
milo   6 years ago
1
I get your point, but multiple tooltips are perfect for form validation and showing new website features where all really need to happen on the onLoad event. There are some hacks online for calling multiple onLoad functions but that really gets complicated for such a simple task here... Same thing with timeout functions since most of the tooltips are being generated based on server side code such as validation, sessions and cookies. I wonder if this issue is also going to be the case with the new version?
hamada
  6 years ago
-2
The new version will still be a single tooltip instance. You have to use a single tooltip to display all your validation message.
milo   6 years ago
0

Well, at the end I gave up and used another solution and it worked fine. Too bad I can only use one instance onload. I really liked this tooltip and find that limitation to be a bit of a concern for my future needs. I suggest that a trigger event be added such as on "creation" to fire up the tooltips upon page load. I will definitely still use it in other projects that do not require that option.

hamada
  6 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: