尝试这个
这是旧的 DEMO:
$(document).ready(function() { $('#modal-content').modal('show'); $('#modal-content').on('shown', function() { $("#txtname").focus(); })});启动引导程序3需要使用shown.bs.modal事件:
$('#modal-content').on('shown.bs.modal', function() { $("#txtname").focus();})


