Problem with jQuery
<p>I trying to create a auto-complete search script (jQuery + PHP) but I have a big problem with this script.</p>

<p>My jQuery code is:</p>

<pre><code>$(document).ready(function() {
  $("#search").keyup(function() {
    var search = $("#search").val();
    if (search.length &gt; 0) {
      $.ajax({
        type: "POST",
        url: "search.php",
        data: "q="+search,
        dataType: "text",
        cache: false,
        success: function(result){
          $("#autocomplete").fadeIn("fast");
          $("#autocomplete").html(result);
        }
      });
    }
  });
  $("#autocomplete").click(function() {
    var complete = $(this).attr("title");
    alert(complete);
    $("#search").focus();
  });
});
</code></pre>

<p>PHP code:</p>

<pre><code>&lt;?php
include("config.php");
header("Content-type: text/html; charset=UTF-8");

$search = $_POST['q'];
if(mb_strlen($search, "UTF-8") &gt; 0) {
  $query = "SELECT * FROM `search` WHERE `title` LIKE '%$search%' ORDER BY `title` ASC";
  $result = mysql_query($query) or die(mysql_error());
  $num = mysql_num_rows($result);
  if($num == 0) {
    echo "Няма резултати";
  }
  else {
    while ($row = mysql_fetch_assoc($result)) {
      echo "&lt;a href=\"javascript:void(0)\" class=\"link\" title=\"{$row['title']}\"&gt;{$row['title']}&lt;/a&gt; &lt;br /&gt;";
    }
  }
}
?&gt;
</code></pre>

<p>but error is in jQuery cuz it can't to get <code>attr("title")</code> of links... </p>

<p>Please help and sorry for my English :) </p>
