EasyUI Forum
September 14, 2025, 02:29:35 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Textbox Icon Tooltip on mouseover [Solved]  (Read 16776 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: March 30, 2015, 06:11:05 AM »

Is it possible to add a tooltip mouseover to a textbox icon ?


Code:
    $('a.textbox-icon').tooltip({
      showEvent: 'hover',
      onShow:function(){
        alert('Hello World');
      }
    })
« Last Edit: March 31, 2015, 07:35:27 PM by devnull » Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: March 30, 2015, 09:15:05 AM »

You can call 'getIcon' method to get an icon and create a tooltip on it.
Code:
$('#tt').textbox('getIcon',0).tooltip({
content:'tooltip content'
})
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 on: March 30, 2015, 07:07:49 PM »

Thanks very much, but I have a few problems in my implementation, not sure if you can help:

The main purpose of this is to use it for multiline-textbox where the space is limited and it is a readonly field, so the user will see the beginning of the text, but can mouseover so see the full text with carriage returns etc

http://jsfiddle.net/seKvb/35/'

1) The first time you mouseover, the tooltip is offset to the right
2) I cannot get the carriage returns to be converted to <br>
3) I want to prevent the tooltip from showing at all if value is null, now it shows for a second and then hides.
4) when using icon in multiline box, the gray textarea 'border' appears on the right of the textbox.

Code:
     $('input.valuetip').css('text-overflow','ellipsis').each(function(){
        $(this).textbox({icons:[{iconCls:'icon-info'}]}).textbox('getIcon',0).tooltip({
        onShow:function(e){
          var val = $($(this)[0]).closest('.textbox').prev('input').textbox('getValue').replace(/(\r\n|\n|\r)/g,"<br />");
          if(!val) $(this).tooltip('hide');
          else $(this).tooltip('update','<span class="vtip">'+val+'</span>');
        }
        });
      })



« Last Edit: March 30, 2015, 10:01:41 PM by devnull » Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #3 on: March 31, 2015, 05:31:17 PM »

Please try this updated example http://jsfiddle.net/seKvb/38/
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #4 on: March 31, 2015, 06:01:46 PM »

Hi;

Thanks, that is an improvement, however it only appears to work if the value is set when the element is created.

See this update, where the second input is updated after, the tooltip does not get the input value.

http://jsfiddle.net/seKvb/39/

Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #5 on: March 31, 2015, 07:21:14 PM »

Please try this example http://jsfiddle.net/seKvb/40/ again.
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #6 on: March 31, 2015, 07:30:04 PM »

Thanks very much, I added back the multiline code:

http://jsfiddle.net/seKvb/41/

Logged

-- Licensed User --
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!