2011-07-14 143 views
0

在用ajax加載頁面並用javascript顯示html時,我插入了css,但它不起作用。jquery不工作css函數

$(document).ready(function(){ 
    $(".potot").hover(
      function (e) { 
      $(".titles").css("display","block"); 
      $.ajax({url:"title/title.php?n="+this.id,success:function(result){ 
      id("titles2").innerHTML = result; 
      }}); 
     }, 
     function (e) { 
     $(".titles").css("display","none"); 
     }); 
    }); 

不工作...

+1

'show()'和'hide()'是你的朋友:) – alex

+1

wat id(「titles2」)。innerHTML = result;這代表.. – K6t

回答

3

什麼是id("titles2")參考?你的意思是使用$('#titles2').href(result);

1

試試這個代碼 -

$(document).ready(function(){ 
    $(".potot").hover(
      function (e) { 
      // $(".titles").css("display","block"); 
       $(".titles").show(); 
       $.ajax({url:"title/title.php?n="+this.id,success:function(result){ 
      //id("titles2").innerHTML = result; 
       $("#titles2").html(result); 
      }}); 
     }, 
     function (e) { 
     //$(".titles").css("display","none"); 
      $(".titles").hide(); 
     }); 
    }); 
0

非常感謝喬恩埃裏克森和維韋克,我已經得到了上述問題的解決方案。

「錯誤的函數」

$(".potot").hover(

「改變與」

$(".potot").live("hover",function(e){ 

也許有一天我會需要你的幫助,感謝你的回答。