Grow your CSS skills. Land your dream job.

How to use “this” in jQuery?

  • # July 5, 2012 at 10:30 am

    Hi All,

    Just trying to figure out how to use the “this” selector in jQuery. I am looking for when one li item is clicked that word changes rather than all of them like they are doing right now. My code is below.

    Update:
    The solved code is on my CodePen page http://codepen.io/jbatzel1/pen/this/11


    • Yeti Mountain Bikes

    • Gary Fisher Mountain Bikes

    • Iron Horse Mountain Bikes




    • GT Mountain Bikes

    • Trek Mountain Bikes

    • Specialized Mountain Bikes

    $(".bike1").click(function(){
    $(this).html("Mountain Bikes");
    });
    # July 5, 2012 at 10:37 am

    Figured it Out!

    # July 5, 2012 at 10:55 am

    Thanks for your input. Please indicate the topic as solved. This will improve visibility in the list of forum items and we go to avoid resolving the issue, as when making a rhetorical question.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".