KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
OK, I'm by no means a JavaScript guru, and perhaps I'm still thinking in terms of Desktop software development, but this is what I'm trying to achieve : I'm using Twitter Bootstrap's Modals In some cases, before an action takes place, I want to verify it with a "Are you sure?" (Yes/No) Modal Dialog. Question : What should the inner logic be? I mean : User clicks buttonA (which ultimately performs actionA) I want to launch the modal, wait for the input (either of the 2 buttons - yes/no) and/or pass it to some checking routine before performing(or not) actionA This my HTML code for the modal (should the buttons be - somehow - acting via their onclick javascript routines?) - also note that #confirmMessage is going to be variable. <div class="modal fade hide" id="confirmAlert"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">x</button> <h3 id="confirmTitle">Are you sure?</h3> </div> <div class="modal-body"> <p id="confirmMessage">Body</p> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#" class="btn btn-danger">Yes</a> </div> </div> Just an idea: Write a function like checkBeforeExec(message,functionToExec) Set #confirmMessage to message and Yes' href to javascript:functionToExec Makes sense? I know it may sound a bit confusing - but I simply do not know what the most javascript-friendly way to do this would be...
Tags (comma-separated)
Save Edits
Cancel