Showing classes, IDs & tag names in the status bar

April 3rd, 2004

A useful tip for debugging a Web page.

To display the CSS class name of objects on the page as you move the mouse over them, add the following JavaScript in the head section of the page (or in the link .js file):

document.onmouseover=Function("window.status=event.srcElement.className");

The class name is displayed in the status bar.

You can do the same thing for element names (change className to tagName) or IDs (change className to id).

Leave a comment