cursor Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:cursor

Description

The cursor property sets or gets the type of cursor.

Property Values

Value
alias
all-scroll
auto
cell
context-menu
col-resize
copy
crosshair
default
e-resize
ew-resize
help
move
n-resize
ne-resize
nesw-resize
ns-resize
nw-resize
nwse-resize
no-drop
none
not-allowed
pointer
progress
row-resize
s-resize
se-resize
sw-resize
text
URL
vertical-text
w-resize
wait
zoom-in
zoom-out
initial
inherit

Technical Details

Item Value
Default Value: auto
Return Value: A String, representing the displayed mouse cursor when the mouse pointer is over an element
CSS VersionCSS2

Get the cursor type value

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP" style="cursor:wait;">This is a paragraph. Mouse over me.</p>

<button type="button" onclick="myFunction()">Return type of cursor</button>

<script>
function myFunction() {//from w  ww. j  a  va2  s  .  c  o m
    console.log(document.getElementById("myP").style.cursor);
}
</script>

</body>
</html>

Related Tutorials