jquery - Adding tooltip to image from PHP -


so followed example: http://www.ehow.com/how_10010263_put-php-code-tooltip.html , i'm building jqgrid in 1 column have images title want tooltips(because image title disapper after time in browsers). in php use install image:

 $image = "<div id='tooltip'>                <img height='16' width='16' title='$image_title'                 src='". base_url()."img/icons/blue/bubble5.png'>            </div>"; 

then try in jquery:

$("#tooltip img[title]").tooltip(); 

however there no effect.

any ideas doing wrong?

edit: how 1 cell image looks in jqgrid:

<div id="tooltip">     <img width="16" height="16" src="path/img/icon/blue/bubble5.png" title="random test"> </div> 

can there problem because have 20 rows same content title different.

my imports:

<script src="<?php echo base_url(); ?>js/jquery-1.4.2.min.js" type="text/javascript"></script>     <script src="<?php echo base_url(); ?>js/i18n/grid.locale-si.js" type="text/javascript"></script>     <script src="<?php echo base_url(); ?>js/jquery.jqgrid.min.js" type="text/javascript"></script>     <script src="<?php echo base_url(); ?>js/jquery.cookie.js" type="text/javascript"></script>     <script src="<?php echo base_url(); ?>js/jquery.qtip-1.0.0-rc3.min.js" type="text/javascript"></script>     <script src="<?php echo base_url(); ?>js/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>     <script src="<?php echo base_url(); ?>js/leadfunctions.js" type="text/javascript"></script>      <script src="<?php echo base_url(); ?>js/sorttable.js" type="text/javascript"></script>      <script src="<?php echo base_url(); ?>js/switcherfunctions.js" type="text/javascript"></script>      <script src="<?php echo base_url(); ?>js/jquery.colorbox.js" type="text/javascript"></script>  

since image thing in <div> suggest try adding class <img> tag(s).

<img class="tt" height='16' width='16' title='$image_title'             src='". base_url()."img/icons/blue/bubble5.png'> 

then can use

$(".tt").tooltip(); 

this way every image tag class have tooltip applied , use title default.

if prefer simple approach, example @ jqueryui example page shows can do

$(document).tooltip(); 

then every item on page title have tooltip associated it.

edit: after update version possible initial solution work.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -