wilcode
wilcode

Reputation: 625

Changing span text when a seperate div's class changes - jQuery

Thanks in advance for taking a look at my question.

I have a div with a background image and when it is clicked, I am adding another class which changes this image.

I also want to change some text in a span that I have when this div is clicked.

I've attempted it below, but it has stopped the class from being added:

$('.rpLeftArm').click(function () {

            $('.rpLeftArm').addClass("rpLeftArmActive")
            $('#currentStep').html("Pick up the hand furthest away from you and place the back of their hand onto their opposite cheek. <span style="color: Red;">Keep your hand there to guide and support their head as you roll them.</span>");
        });

I've tried putting the span text change into another function that is triggered but I'm doing that wrong too.

Any help would be appreciated.

Upvotes: 1

Views: 165

Answers (1)

Roko C. Buljan
Roko C. Buljan

Reputation: 206028

Put single quotes around your SPAN <span style='color:red;'>

$('.rpLeftArm').click(function () {    
      $('.rpLeftArm').addClass("rpLeftArmActive");
      $('#currentStep').html("Pick up.... <span style='color: red;'>Keep your...</span>");
});

Upvotes: 1

Related Questions