KeyboardEvent: thuộc tính shiftKey

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thuộc tính chỉ đọc KeyboardEvent.shiftKey là một giá trị boolean cho biết phím shift có được nhấn (true) hay không (false) khi sự kiện xảy ra.

Việc nhấn phím shift cũng có thể thay đổi unsupported templ: domxref("keyboardevent/key", "key")} của sự kiện. ví dụ: nhấn b tạo ra `key: "b"`, trong khi nhấn đồng thời shift tạo ra `key: "b"`. ## giá trị một giá trị boolean. ## ví dụ ```html

nhấn bất kỳ phím ký tự nào, có hoặc không giữ phím shift.
bạn cũng có thể sử dụng phím shift cùng với phím alt.


```

```js
const output = document.getelementbyid("output");

function showchar(e) {
  output.textcontent = `phím keydown: "${e.key}"
phím shift keydown: ${e.shiftkey}
`;
}

document.addeventlistener("keydown", showchar);
```

{{