Turk
Turk

Reputation: 232

How to use bootbox with rails?

I have the following:

<button type="button submit id="delete-selected" class="btn btn-danger></button>

then some more code...

<script>
$(function(){
 $('#delete-selected').click(function(e){
 var currentButton = this;
 e.preventDefault();
   bootbox.confirm("Are you sure", function(confirmed){
   if(confirmed){
   currentButton.submit();
   }
   });
   });
</script>

Now everything works fine...except the button won't actually submit anything when I click OK...

Upvotes: 1

Views: 252

Answers (1)

Turk
Turk

Reputation: 232

so I realized what I was doing makes no sense... last line should be changed to :

$('form').submit();

as obviously you can't submit a button..works now :)

Upvotes: 1

Related Questions