Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在表单中使用 Bootstro 和 Bootstrap。它正在以应有的方式工作。但我想做点什么:
当我单击按钮启动 bootstro 时,它从表单中的第一个元素开始。我想在我关注的领域开始引导。如果我没有专注于任何领域,它应该从头开始。
谢谢。
像这样的事情应该这样做。您将获取选定的输入并使用它,或者使用默认值。
var focusedEl = $('input:focus'); var myEl; if (focusedEl.length) { myEl = focusedEl; } else { myEl = $('#someOtherElement'); } $(document).ready(function(){ bootstro.start(myEl, options); });