0

I want my tooltip to appear in the div (see picture) after the user clicks on the input. Nothing will be in this div until the user clicks on the input.

My jQuery :

 $("#orderform :input").tooltip({ // place tooltip on the right edge position: "bottom right", // a little tweaking of the position offset: [0, 10], // use the built-in fadeIn/fadeOut effect effect: "fade", // custom opacity setting opacity: 0.7 }); 

Screen

My jsFiddle CLICK

5
  • The jsfiddle doesn't look like the image. Are you missing css? Commented Mar 26, 2014 at 16:28
  • In jsfiddle my tooltip is greater than on my website. It's only one difference Commented Mar 26, 2014 at 16:30
  • Read about Api methods of tooltip plugin here. Tooltip plugin had mepod open, for custom showning tooltip. $( ".selector" ).tooltip( "open" ); Commented Mar 26, 2014 at 16:53
  • Ok.. I think you want to use the tooltip for something that the tooltip is not for.. But if you want to show/hide info text next to the input then you better of with this kind of setup: jsfiddle.net/wCXB3/2 Commented Mar 26, 2014 at 16:54
  • @Sven, Yeah on your jsfiddle it's working grat but on my website not... Here's link spacesms.pl/index.php?show=form_rej&pakiet=8 Commented Mar 26, 2014 at 17:02

1 Answer 1

1

If I understand your question correctly, you want the div on the right to only appear when the user clicks on the input field. This does not require a tooltip. Tooltips are designed to appear over the trigger object or very near to it. You have a static object that you want to show or hide based on another object. Since you are using an input field, you can use the focus and blur events to trigger the fadeIn and fadeOut methods respectively.

The jQuery:

$(document).ready(function() { $('.komunikat').hide(); //hide the div $('#orderform :input').focus(function(){ $('.komunikat').fadeIn(); //show the div when the input is in focus (clicked or tabbed) }); $('#orderform :input').blur(function(){ $('.komunikat').fadeOut(); //hide the div when the input is out of focus (blurred) }); }); 

DEMO

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.