Javascript 工具提示不适用于动态创建的内容php

Javascript 工具提示不适用于动态创建的内容php,javascript,php,jquery,css,tooltip,Javascript,Php,Jquery,Css,Tooltip,我在应用程序中使用工具提示,但它不能处理动态内容 当我在静态内容上使用工具提示时,效果很好。看 但是,在动态内容上创建时,它不起作用 问题:鼠标悬停时工具提示隐藏;工具提示div.tooltip不应隐藏。 如果你想看直播,请看这里:http://propertydefine.com/ <script> $(document).ready(function(){ $('[rel=tooltip]').bind('mouseover', function () { if ($

我在应用程序中使用工具提示,但它不能处理动态内容

当我在静态内容上使用工具提示时,效果很好。看

但是,在动态内容上创建时,它不起作用

问题:鼠标悬停时工具提示隐藏;工具提示
div.tooltip
不应隐藏。 如果你想看直播,请看这里:
http://propertydefine.com/

<script>
$(document).ready(function(){

$('[rel=tooltip]').bind('mouseover', function () {
    if ($(this).hasClass('ajax')) {
        var ajax = $(this).attr('ajax');
        $.get(ajax, function (theMessage) {
            $('<div class="tooltip">' + theMessage + '</div>').appendTo('body').fadeIn('fast');
        });
    } else {
        var theMessage = $(this).attr('content');
        $('<div class="tooltip">' + theMessage + '</div>').appendTo('body').fadeIn('fast');
    }

    $(this).bind('mousemove', function (e) {
        $('div.tooltip').css({
            'top': e.pageY - ($('div.tooltip').height() / 2) - 5,
                'left': e.pageX + 15
        });
    });
});

$(document).on('mouseout click', 'div.tooltip', function(){
    $('div.tooltip').fadeOut('slow', function(){
        $(this).remove();
    }); 
});

});
</script>

$(文档).ready(函数(){
$('[rel=tooltip]')。绑定('mouseover',函数(){
if($(this).hasClass('ajax')){
var ajax=$(this.attr('ajax');
$.get(ajax,函数(theMessage){
$(''+theMessage+'').appendTo('body').fadeIn('fast');
});
}否则{
var theMessage=$(this.attr('content');
$(''+theMessage+'').appendTo('body').fadeIn('fast');
}
$(this.bind('mousemove',函数(e){
$('div.tooltip').css({
“顶部”:e.pageY-($('div.tooltip').height()/2)-5,
“左”:e.pageX+15
});
});
});
$(文档).on('mouseout click','div.tooltip',function(){
$('div.tooltip').fadeOut('slow',function()){
$(this.remove();
}); 
});
});
php代码:

<?php
    include 'config.php'; 
//$query = "
//SELECT UserName,firstName,lastname,Mobile_Number1,Type_cust,City,location,Company_name,company_logo FROM registration WHERE City = 'Navi Mumbai'";
$query="SELECT registration.UserName,firstName,lastname,Mobile_Number1,Type_cust,City,location,Company_name,company_logo FROM registration LEFT JOIN featureddealer on registration.UserName=featureddealer.UserName WHERE City = 'Navi Mumbai' and ActiveFlag='y'" ;
$result = mysql_query($query) or die ("Query failed");
//get the number of rows in our result so we can use it in a for loop
$numrows = (mysql_num_rows ($result));
// loop to create rows
if($numrows >= 1){
for ($r = 0; $r <= $numrows; $r++) {
// loop to create columns
while ($friendList = mysql_fetch_array($result))
 {     
 $_SESSION['firstName'] = $friendList['firstName'];

//Create table

if($friendList['company_logo'] == "")
{
$friendList['company_logo'] = "images/nophoto.jpeg";
}


echo " <tr> <td class='td2'>"; 

echo '<a href=#  alt=Image id='.$friendList['Company_name'].' class=clicker Tooltip rel=tooltip content="<div class=td2><div id=imagcon><img width=100px height=100px    src=Dealer/'.$friendList['company_logo'].' class=tooltip-image /></div> <div id=con>'.$friendList['Company_name'].'</div><div id=con> '.$friendList['location'].' '.$friendList['City'].'</div><div id=con> '.$friendList['Type_cust'].' :'.$friendList['firstName'].' '.$friendList['lastname'].'<div id=con> 9930651106 </div> </div> <div id=con> <a href=# > View All Details </a>   </div>
<br/>

  <div id=con >


  '

  ;






  ?>



  <?php


您必须先绑定到
mousemove
,然后才能使用它

$(this).bind('mousemove', function (e) {
    $('div.tooltip').css({
        'top': e.pageY - ($('div.tooltip').height() / 2) - 5,
            'left': e.pageX + 15
    });
});
以前

if ($(this).hasClass('ajax')) {
    var ajax = $(this).attr('ajax');
    $.get(ajax, function (theMessage) {
        $('<div class="tooltip">' + theMessage + '</div>').appendTo('body').fadeIn('fast');
    });
} else {
    var theMessage = $(this).attr('content');
    $('<div class="tooltip">' + theMessage + '</div>').appendTo('body').fadeIn('fast');
}
if($(this).hasClass('ajax')){
var ajax=$(this.attr('ajax');
$.get(ajax,函数(theMessage){
$(''+theMessage+'').appendTo('body').fadeIn('fast');
});
}否则{
var theMessage=$(this.attr('content');
$(''+theMessage+'').appendTo('body').fadeIn('fast');
}

您的动态内容在哪里?请提供一些代码。@Lalkrishnan php代码提供了鼠标事件应该放在ajax之后。