<...">
Geek Answers Handbook

Twitter bootstrap href modal not working

<div id="deleteModal" class="modal hide fade" tabindex="-1" role="dialog"> <div class="modal-body"> <span><i class=" icon-info-sign"></i> </div> <div class="modal-footer"> <a class="trashconfirm btn btn-info" data-dismiss="modal" href="javascript:void(0)">Yes</a> <a class="btn btn-info" data-dismiss="modal">No</a> </div> </div> 

I am using jquery to install hre.

  $(".accordion").on('click','.dairytrash',function() { var id = $(this).closest('tr').attr('id'); var ele = $(".modal-footer .trashconfirm "); ele.attr('href','<c:url value="/delete?id='+id+'" />'); }); 

href also installs correctly, but when I do nothing, it happens.

+4
javascript jquery twitter-bootstrap modal-dialog
Saurabh kumar Mar 18 '13 at 9:55
source share
2 answers

If you use data-dismiss="modal" on the button (what you are doing), Bootstrap attaches a click handler to it to hide the modality if the button is pressed. This handler calls preventDefault() on the event, so any default actions (for example, those after href ) will no longer be triggered.

If you want both to call the URL when the button is pressed and hide the modal, you will need to use Javascript to attach an event handler to your button, which will call the URL and hide the modal.

+3
robertklep Mar 18 '13 at 10:22
source share

Use one of the event hooks described in the Bootstrap Docs ( http://twitter.imtqy.com/bootstrap/javascript.html ):

 $('#myModal').on('hidden', function () { // do something… }) 
0
sleepinscorpion Jun 01 '13 at 17:39
source share

More articles:

  • https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1469958/can-we-convert-the-nsdecimal-values-to-uiimage&usg=ALkJrhiWEDu0Xg0xsdyjrAvc2D0zB-JO5w
  • Is it safe to embed try / finally clauses like this? - java
  • Spring AOP - Calling recommendations from a catch block - java
  • "Serialization" SimpleXMLElement "is not allowed. Insert error into session xml value - xml
  • How can I create a custom snap module when binding to a body? - asp.net
  • how to pass a result model object from System.Web.Http.ModelBinding.IModelBinder. Bindmodel? - odata
  • Install ListBox SelectedItems based on another collection - c #
  • Jquery plugin method returns value not object - jquery
  • WebSocket Unexpected response code: 400, RFC 6455 said the answer, how is HTML? - html5
  • writing a log file from a python program - python

All Articles

Geek Answers | 2019