製作網頁時我沒有將注意力集中在Bootstrap Modal的「輸入」中,我嘗試了所有內容並且沒有工作,模態出現但輸入未獲得焦點。我用一個簡單的模式創建了一個「test.php」,但也不起作用。這裏是「test.php的」Bootstrap Modal Focus not working
<html lang="es">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../css/bootstrap.min.css" rel="stylesheet">
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js">
<script>
$('#myModal').on('shown.bs.modal', function() {
$('#referencia').focus();
})
</script>
</head>
<body>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<input name="referencia" id="referencia" type="text" class="form-control text-uppercase" placeholder="Descripción">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</body>
如果我盡我的服務器上的代碼它不工作,unelink.es服務器上也不管用,但如果我把相同的代碼上「小提琴「, 工作正常。
任何想法是什麼錯?如果我需要別的東西......或者在服務器上安裝某些東西。
P.D.對不起我的英語不好。
也許你的瀏覽器沒有找到的jQuery .min.js?如果您使用F12/developer tools/firebug打開瀏覽器,您是否在網絡視圖中看到紅色條目? – Varon
這就是我正在做的事情,它是這樣說的:錯誤:Bootstrap的JavaScript需要jQuery ..但存檔在那裏。爲什麼不加載? – teikuei
如果我嘗試在Chrome上工作......一定是Firefox的東西。正在變得瘋狂。什麼是Firefox的問題?一直工作良好,直到現在。 – teikuei