Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
Using jQuery UI ToolTip

I am using jQuery UI ToolTip like below.

          $( document ).tooltip({
            position: {
              my: "center bottom-20",
              at: "center top",
              using: function( position, feedback ) {
                $(this).css(position);
                var txt = $(this).text();
                $(this).html(txt);
                $( "<div>" )
                  .addClass( "arrow" )
                  .addClass( feedback.vertical )
                  .addClass( feedback.horizontal )
                  .appendTo( this );
              }
            }
          });

My HTML code is like below.

'<span class="tooltip" title="'+ state.text2 +'">' + state.text + '</span>'

But in this way all the title of the page is showing as ToolTip.

How can I use jQuery UI ToolTip specifically on element with class="tooltip" ?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

<!Doctype html>
<html lang = "en">
<head>
  <Meta charset = "utf-8">
  <Title> jQuery UI tooltip Test</title>
  <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <Script src = "// code.jquery.com/jquery-1.9.1.js"> </script>
  <Script src = "// code.jquery.com/ui/1.10.4/jquery-ui.js"> </script>
  <Link rel = "stylesheet" href = "http://jqueryui.com/resources/demos/style.css">
  <script>
  $(function () {
    $("#open-event").tooltip ({
      show: null,
      position: {
        my: "left top",
        at: "left bottom"
      },
      open: function (event, ui) {
        ui.tooltip.animate ({top: ui.tooltip.position ().top + 10.}, "fast");
      }
    });
  });
  </script>
</head>
<body>
 
<p> Tooltip test <a id="open-event" href="#" title="tooltip-test"> test </a></p>
 
 
</body>
</html>
about 4 years ago · Juan Pablo Isaza Denunciar

0

Consider the following.

$(function() {
  $(".tooltip").tooltip({
    position: {
      my: "center bottom-20",
      at: "center top",
      using: function(position, feedback) {
        $(this).css(position);
        var txt = $(this).text();
        $(this).html(txt);
        $("<div>")
          .addClass("arrow")
          .addClass(feedback.vertical)
          .addClass(feedback.horizontal)
          .appendTo(this);
      }
    }
  });
});
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<p>
  <a href="#" title="Anchor description">Anchor text</a>
  <input title="Input help">
  <br />
  <span class="tooltip" title="Text 2">Text 1</span>
</p>

Using the correct Selector, you can target Tooltips for specific elements.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda