Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda