I try to apply a demo modal shown in url:
http://getbootstrap.com/javascript/
after "Varying modal content based on trigger button".
And also use a html code
<input name="email" type="email" id="email" />
...and javascript code
$('#exampleModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget)
var modal = $(this)
modal.find('.modal-title').text('Log In')
modal.find('.modal-body input').val("This Body..")
$(this).find('#email').focus();//why it doesn't work????????
})
How to set the focus function in email-input automatically? Thank you
shown.bs.modalevent instead ofshow.bs.modalplease check my answer below.