Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!