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
I'm unable to add button to a popover

I've been trying to add a button to a popover. I've got a grid of divs, generated via asp.net. My code looks something like this:

$(document).ready(function () {
    $('.hometable').popover({
        html: true,
        trigger: "manual",
        title: function () {
            return $('#popover-title').html();
        },
        content: function () {
            return $('popover-content').html();
        }
    });
    
    $('.hometable').mousedown(){
        $(this).popover("show");
    }
}
<div id="popover-title" class="hide popover_name" hidden>
        <b>Overzicht</b>
</div>
<div id="popover-content" class="hide popover_name" hidden>
    <div>            
        <button>Test</button>
    </div>
</div>

<table> 
    @for(int i = 0; i < 5; i++){
        <tr>
             @for(int j = 0; j < 5; j++){
                 <td class="hometable">
                     <div></div>
                 <td>
             }
        </tr>
    }
</table>

If I replace the button for example by Test it'll work fine, but I cant get the button to be included in anyway. Any suggestions? Thanks in advance!

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

0

It appeared that my button was automatically removed as soon as it was loaded due to the default "sanitize" functionality included into popover. I was able to resolve the issue by adding "sanitize: false" option to my popover initialization. My code now looks like this:

$('.hometable').popover({
        html: true,
        trigger: "manual",
        sanitize: false,
        title: function () {
            return $('#popover-title').html();
        },
        content: function () {
            return $('popover-content').html();
        }
    });
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