1

I've come to a dead end with this code. I can't seem to figure out how to add a hover effect to the link in this code, I was hoping maybe some of you would be able to lend me a hand with this.

This is the code I'm trying to add hover effect to:

if (readmore) {
   var link = wrapper.parent().find('h3 a').attr('href');
   wrapper.append('<br /><br /><span style="float: none;"><span style="display:block; background: #fff; border: 1px solid #000; text-align: center; text-spacing: 2px; text-transform:uppercase; font-weight: bold; padding: 5px 25px 0px; -webkit-border-radius: 0px; -moz-border-radius: 0px; border-radius: 0px; height: 30px; margin-left: 215px;"><a href="' + link + '" style="color: #000">' + readmore + '</a>');

 } 
  wrapper.append('<hr>');
  $('hr').css('width','100%').css('background-color','transparent').css('border-width',0);

Am I missing something here? Any help is much appreciated. Thank you for your time.

Djordje
  • 11
  • 2
  • You cannot add an `hover` effect in inline CSS. You should give a classname to the html element and manage the hover effect in a css stylesheet. This link might be helpful: https://stackoverflow.com/questions/1033156/how-to-write-ahover-in-inline-css – Gaël S Apr 29 '19 at 15:17
  • No reason to use JS for a simple hover effect. CSS all the way. – hungerstar Apr 29 '19 at 15:25
  • Hi @GaëlS, thank you so much for your time and answers. I was able to add the hover effect by predefining the attribute and adding class to the – Djordje Apr 29 '19 at 19:34
  • @hungerstar Thank you for taking time to answer. – Djordje Apr 29 '19 at 19:34

0 Answers0