Good day everyone! There was such a question: how can I call a hint in jQuery. But the bottom line is that the prompt itself is displayed in the jQuery script. Here is my script:

$(document).ready(function(){ $("#resultados").hide(); $('#buscar_usuario').autocomplete( { source: 'ajax.php', select: function(event , ui){ $('#resultados').slideUp('slow', function(){ $('#resultados').html( '<h2>Информация о пользователе<h2>' + '<img src="' + ui.item.foto + '"/>' + '<strong>Пользователь: </strong>' + ui.item.value + '<br/>' + '<strong>Количество предметов: </strong>' +'<a href=# class="tooltip">' + ui.item.descripcion +'<span class="tip">Проверка</span> '+'</a>' ); }); $('#resultados').slideDown('slow'); } }); }); 

I need a hint to be displayed on this line:

 <a href=# class="tooltip">' + ui.item.descripcion +'<span class="tip">Проверка</span> '+'</a>' 

How can I solve this problem?

  • Use ready-made solutions in your case is not an option? Otherwise, I could just offer one small jQuery plugin. - ivkremer
  • Maybe you can do something like a place for hints so that a modal window is displayed when you click on this link - yurik

1 answer 1

For dynamically created elements, you need to use the live method. Here is a sample code, when you click on your element ( a link ), a dialog box crashes.

 $('.tooltip').live('mouseover', function() {alert('это предмет №тра-та-та'); }); 

I think it will not be difficult for you to improve it so that instead of a window there will be a hint. :)

  • Thanks for the help. I will definitely finish the example ... - yurik