Search code examples
javascripttwitter-bootstrapconfirm

Bootstrap Confirmation - Apply an onConfirm function on element properties


I want to apply a js function to my confirmation button, I Create the elements outside of the page and get them with ajax, so it's very important that i could set the function in-properties and not via $('#id').confirmation()

This is what i got so far: the confirmation is popping, but does not call the do_it function on confirmation. (when i run do_it from the console, it works perfectly).

<button id="someid" class="btn" data-toggle="confirmation" data-onConfirm=do_it(1,2)>
                            ButtonText
</button>

Solution

  • i think you are using the wrong attribute value. It should be "data-on-confirm" .Please refer the link at http://mistic100.github.io/Bootstrap-Confirmation/