javascript - Using bootstrap on confirm message onclick() -


i'm new bootstrap, , i've code message confirmation.

how can put onclick() using code below?

$("#mymodal").on("show", function() {    // wire ok button dismiss modal when shown     $("#mymodal a.btn").on("click", function(e) {         console.log("button pressed");   // example...         $("#mymodal").modal('hide');     // dismiss dialog     }); }); $("#mymodal").on("hide", function() {    // remove event listeners when dialog dismissed     $("#mymodal a.btn").off("click"); });  $("#mymodal").on("hidden", function() {  // remove actual elements dom when hidden     $("#mymodal").remove(); });  $("#mymodal").modal({                    // wire actual modal functionality , show dialog   "backdrop"  : "static",   "keyboard"  : true,   "show"      : true                     // ensure modal shown }); 

html of bootbox:

html (image)

onclick() input:

<input type='submit' name='actualiza_noticia' class='button' onclick="" value='atualizar notícia'>     

you can use either use jquery function $(elem).modal('show') function, or bootstrap html data attributes:

using data attributes:

<input type='submit' data-toggle="modal" data-target="#mymodal" name='actualiza_noticia' class='button' value='atualizar notícia' >     

using jquery function:

<input onclick="$('#mymodal').modal('show')" type='submit' name='actualiza_noticia' class='button' value='atualizar notícia' >     

these shuold both trigger events, although 'show' event 'shown.bs.modal' in compliance bootstrap 3:

$("#mymodal").on('shown.bs.modal', function() {    // wire ok button dismiss modal when shown     $("#mymodal a.btn").on("click", function(e) {         console.log("button pressed");   // example...         $("#mymodal").modal('hide');     // dismiss dialog     }); }); 

read more bootstrap modal here.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -