You can simply use the jQuery .focus() method to set the focus on the first input box or textarea inside the Bootstrap modal when it is loaded upon activation.
Let's try out the following example to understand how it basically works:
The jQuery code in the above example simply finds the <input> element and set focus on it when modal is visible to the user using the modal's shown.bs.modal event.
Use the jQuery
.focus()methodYou can simply use the jQuery
.focus()method to set the focus on the first input box or textarea inside the Bootstrap modal when it is loaded upon activation.Let's try out the following example to understand how it basically works:
The jQuery code in the above example simply finds the <input> element and set focus on it when modal is visible to the user using the modal's shown.bs.modal event.
need an explanation for this answer? contact us directly to get an explanation for this answer