
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
JavaScript Cursor property
The cursor property is sets or returns the cursor type that will be displayed for the cursor property.
Following is the code for implementing JavaScript Cursor property −
Example
<!DOCTYPE html> <html> <head> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } </style> </head> <body> <h1>JavaScript Cursor property</h1> <p class="sample"></p> <h3> Hover the mouse over the above paragraph after clicking the below button </h3> <button class="Btn">Change Cursor</button> <script> let sampleEle = document.querySelector(".sample"); document.querySelector(".Btn").addEventListener("click", () => { sampleEle.style.cursor = "crosshair"; }); </script> </body> </html>
Output
On clicking the “Change Cursor” button −
- Related Articles
- Cursor property of CSS
- Example of CSS Cursor Property
- HTML DOM Style cursor Property
- Values for the CSS cursor property
- How to set the cursor to wait in JavaScript?
- How to find the coordinates of the cursor with JavaScript?
- Hide the cursor on a webpage using CSS and JavaScript
- How to change cursor to waiting state in JavaScript/jQuery?
- JavaScript Math.LN10 Property
- JavaScript symbol.description property
- JavaScript Symbol.hasInstance Property
- JavaScript global Property
- JavaScript Infinity Property
- JavaScript lastIndex Property
- JavaScript multiline Property

Advertisements