HIDE SPECIFIC TEXT WITH JQUERY ON MOUSEOVER

Jayden Bell

Total Post:110

Points:774
Posted by  Jayden Bell
 957  View(s)
Ratings:
Rate this:
Hi Expert!

I can't seem to get this to work:

$('.products-grid li').hover(
function(){
    $('.price').html().replace('DKK','');
});
I want the "DKK" to not show, when the mouse is over the list-item. I know I can do this by adding a span around the DKK, but this is not possible for me to 

do so. I'm locked within the setup of the HTML as you see it here.

http://jsfiddle.net/4UeMd/

Hope someone can help me. This might be a simple jQuery coding I'm missing, but I can't quite figure it out.

Thanks in advance.
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Hide specific text with jquery on mouseover

    Hi Jayden!

    Try this way

    Set the html of the element in the script. Currently the script just modifies the innerHtml of .price it does not set the html of price.

    $('.products-grid li').hover(
        function(){
            $('.price').html($('.price').html().replace('DKK',''));

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!