The way to change cursor of an element with Javascript

To change cursor of an element with Javascript, we use cursor property of an element:

 document.getElementById('yourElement').style.cursor = 'pointer';


Use click event to change:

 function onChangeCursor(cursorType) {
  document.getElementById('yourElement').style.cursor = cursorType;
}


The style.cursor property can override any cursor style of an element
Some cursor types: default, auto, pointer, copy, help, move, progress, wait, zoom-in, zoom-out... or none





© 2019 4codev

Created with love by Sil.