Search code examples
htmlaccessibilityonmouseoverjaws-screen-reader

How do I prevent JAWS to say onmouseover in html


I have code like this in HTML login page:

<input type="submit" class="button" onmouseover="hover(this, 1)" 
onmouseout="hover(this, 0)" value="Enter" name="feature=111" id="login-button">

Every time I come to the button with keyboard it says "Enter button onmouseover". How do I prevent it from saying onmouseover? I'm not looking for JAWS options, I'm looking for some optional attribute or something like that.


Solution

  • Remove the inline javascript:

    <script>
      var button = document.findElementById('login-button');
      button.addEventListener('onmouseover', function(event) { hover(event.target, 1) });
      button.addEventListener('onmouseout', function(event) { hover(event.target, 0) });
    </script>
    
    <input type="submit" class="button" value="Enter" name="feature=111" id="login-button">
    

    or use the css :hover pseudoselector if it the hover() function is just for styling.