Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get the element the cursor hovering over

window.addEventListener('click', function(e) {
  var x = e.clientX;
  var y = e.clientY;
  var hoverElement = document.elementFromPoint(x, y);
  console.log(`Hover element is ${hoverElement.tagName}`);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: delete element 
Javascript :: how to use typeof in javascript 
Javascript :: While loop factorial function in javascript 
Javascript :: wait for ajax to finish 
Javascript :: javascript spread and rest operator 
Javascript :: javascript allow only numeric characters 
Javascript :: mongoose connect to mongodb 
Javascript :: javascript split by backslash 
Javascript :: lodash remove element from list 
Javascript :: axios set body 
Javascript :: javascript nth root 
Javascript :: redux devtools extention in redux toolkit 
Javascript :: discord.js button 
Javascript :: automatically scroll to bottom of page javascript 
Javascript :: conditional field validation with Yup 
Javascript :: datepicker strart with monday 
Javascript :: react conditional styling 
Javascript :: moment js current date without format 
Javascript :: js new date short format 
Javascript :: js-cookie set expiration of cookie 
Javascript :: expo react native 
Javascript :: jquery toggleclass 
Javascript :: js check string for isogram 
Javascript :: window bind load jquery 
Javascript :: user api testing 
Javascript :: javascript find all matches in array 
Javascript :: concantene number in js 
Javascript :: is object js 
Javascript :: js window.alert 
Javascript :: javascript array push element at index 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =