twitter-bootstrapbootstrap-dialog

How to set text-field and retrieve value from it in BootstrapDialog


I'm using monkey friendly version of Bootstrap modal for dialog boxes using "BootstrapDialog" instead of writing a lengthy code. But i'm not sure how to create text field inside the box, so that i can get value from it and use it in my code similar to "prompt()". Thank You


Solution

  • Updated fiddle: http://jsfiddle.net/v4E4S/2/

    Main change was to move everything inside the $(document).ready(function () { The questions should be displayed on click of OK button of the modal:

    $(".modal-footer button").on('click', function () {
            var userName = $("#txtUsername").val();
            displayName(userName);
            displayQuestions(questions, options)
    });