twitter bootstrap popover on ajax loaded content -


i trying assign popover twitter bootstrap element wich loaded via ajax , have this:

        $(document).on("click", ".checkrezolvatatrecut", function(event){         switch(datachecktrecut[1]) {             case '02':                  var luna = "februarie";                 break;         }         $(".checkrezolvatatrecut").popover({             placement: "top",             content: "<button class='btn btn-default mutatrecut' style='width: 100px;'>" + luna + "</button><button class='btn btn-default mutacurent' style='width: 100px;'>luna curenta</button>",             html: true          });     }); 

the problem on first click nothing happens. after first click works. mention, didnt understood bootstrap js well. ideas ?

thanks!

it's normal on first click nothing happens, because it's on first click setting popover, once set (in first click) popover show in next clicks,

if want show on first click should set popover when jquery ready :

$( document ).ready(function() {    switch(datachecktrecut[1]) {         case '02':              var luna = "februarie";             break;     }     $(".checkrezolvatatrecut").popover({         placement: "top",         content: "<button class='btn btn-default mutatrecut' style='width: 100px;'>" + luna + "</button><button class='btn btn-default mutacurent' style='width: 100px;'>luna curenta</button>",         html: true      }); }); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -