get Safari HTML Element ID

I want to get the Element ID or Class from a Safari webpage and highlight the element the mouse is over in order to create a content blocker hiding listing.
How can this be done?

Replies

Get element by ID:
Code Block
document.getElementById("demo");


Get elements by class name (returns an array of all elements with that class name):
Code Block
document.getElementsByClassName("demo");


Highlight element mouse is over (not tested, also need to remove highlight once mouse is no longer over element):
Code Block
document.addEventListener('mousemove', function (e) {
var srcElement = e.srcElement;
srcElement.style.backgroundColor = "yellow";
});