
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the role of Keyboard Event ctrlKey Property in JavaScript?
The ctrlKey property is used to show whether the CTRL key is pressed or not when key event was triggered. You can try to run the following code to learn how to implement a ctrlKey property in JavaScript −
Example
<!DOCTYPE html> <html> <body> <input type = "text" onkeydown = "funcCtrlKey(event)"> <div id = "res">Press any key</div> <script> function funcCtrlKey(event) { var val = document.getElementById("res"); if (event.ctrlKey) { val.innerHTML = "CTRL key: Pressed"; } else { val.innerHTML = "CTRL key: NOT Pressed"; } } </script> </body> </html>
- Related Questions & Answers
- What is the role of ctrlKey Mouse Event in JavaScript?
- What is the role of Keyboard Event shiftKey Property in JavaScript?
- What is the role of Keyboard Event altKey Property in JavaScript?
- What is the role of altKey Mouse Event in JavaScript?
- What is the role of clientX Mouse Event in JavaScript?
- What is the role of clientY Mouse Event in JavaScript?
- What is the role of pageX Mouse Event in JavaScript?
- What is the role of pageY Mouse Event in JavaScript?
- What is the role of screenX Mouse Event in JavaScript?
- What is the role of screenY Mouse Event in JavaScript?
- What is the role of shiftKey Mouse Event in JavaScript?
- What is the role of pageXOffset property in JavaScript?
- What is the role of scrollY property in JavaScript?
- What is the role of scrollX property in JavaScript?
- What is the role of global RegExp property in JavaScript?
Advertisements