cursor 속성은 cursor 속성에 대해 표시할 커서 유형을 설정하거나 반환합니다.
다음은 JavaScript Cursor 속성을 구현하는 코드입니다 -
예시
<!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> 출력

"커서 변경" 버튼을 클릭하면 -
