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 −


 Live Demo

<!DOCTYPE html>
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
<h1>JavaScript Cursor property</h1>
<p class="sample"></p>
Hover the mouse over the above paragraph after clicking the below button
<button class="Btn">Change Cursor</button>
   let sampleEle = document.querySelector(".sample");
   document.querySelector(".Btn").addEventListener("click", () => { = "crosshair";


On clicking the “Change Cursor” button −