form input text modal focus code example

Example 1: To focus on the textbox when bootstrap pop-up is open

$("#dialog-cancelReasonModal").on('shown.bs.modal', function () {
                $(this).find('#txtName').focus();
            });

•	ID of the bootstrap POP-UP = dialog-cancelReasonModal 
•	ID of the TextBox = 'txtName'

Example 2: How to Set focus to first text input in a bootstrap modal after shown

<input value="" autofocus>
 // not tested yet
// https://stackoverflow.com/questions/15247849/how-to-set-focus-to-first-text-input-in-a-bootstrap-modal-after-shown

Tags:

Misc Example