Plot a line over html text with CSS text-decoration - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:css

Description

Plot a line over html text with CSS text-decoration

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>JQuery example</title> 
 </head> //w ww.j  a  v  a2s .  c o m
 <body> 
  <p> Hover over <u>this</u> word to highlight <i>this</i> word </p> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
  <script>
      $('u').on('mouseenter', function(){
        $('i').css('text-decoration', 'underline');
      });
      $('u').on('mouseleave', function(){
        $('i').css('text-decoration', 'none');
      });
    
      </script>  
 </body>
</html>

Related Tutorials