我有一個表單,我需要允許用戶使用鍵盤單擊洗掉和添加。一般規則是用戶使用 Tab 鍵將焦點從一個控制元件轉移到另一個控制元件。
當為表單按下選項卡時,活動控制元件將僅移動到文本框,而不是添加和洗掉角按鈕。
我正在使用引導程式 5.2
<!doctype html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/somethinggoodone/cdn/AniketPradhan_bootstrap.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-OERcA2EqjJCMA /3y gxIOqMEjwtxJY7qPCqsdltbNJuaOe923 mo//f6V8Qbsw3"
crossorigin="anonymous"></script>
</head>
<body>
<div class="input-group">
<span class="input-group-text">??</span>
<input type="text" aria-label="First name" class="form-control">
<input type="text" aria-label="Last name" class="form-control">
<span class="input-group-text"> </span>
</div>
<div class="input-group">
<span class="input-group-text">??</span>
<input type="text" aria-label="First name" class="form-control">
<input type="text" aria-label="Last name" class="form-control">
<span class="input-group-text"> </span>
</div>
</body>
uj5u.com熱心網友回復:
默認情況下,Span 不是可選項卡式控制元件。您可以通過在它們上設定tabindex
屬性使它們可制表:
<span class="input-group-text" tabindex="0">??</span>
或者,您可以使用帶有 href 的錨標記:
<a class="input-group-text" href="#">??</a>
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/537400.html
標籤:javascript网页格式CSSbootstrap-5
上一篇:使用z-index懸停時顯示的CSS文本導致div移動
下一篇:選擇所有日語文本,但不使用羅馬化