Freemote Logo

Coding Wiki

Most Common Coding Questions

Find answers to popular programming questions and level up your coding skills

Hover over button for description html

Learn how to add a hover effect to a button in HTML using JavaScript.

Answer:

How do I add a hover effect to a button in HTML?

html
html
<button onmouseover="displayDesc" onmouseout="hideDesc">Hover over me</button>
<script>
function displayDesc() {
  document.getElementById('desc').style.display = 'block';
}
function hideDesc() {
  document.getElementById('desc').style.display = 'none';
}
</script>
<div id='desc' style="display: none;">This is the button description.</div>
Tags:
htmljavascript
☾☾☾
+++++++++
Level Up Your Coding Skills

JavaScript Cheat Sheet

Remember the essentials of 5 different languages, it's free.