treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Turn variables into jQuery objects

  • Hey everybody,

    how would i turn something like this

    var elemTitle = $(this).attr('title');
    var tipContent = '<div class="tippyTip">'+elemTitle+'</div>';


    into a jQuery object that i can apply things like hide() to before it ever shows up on the page?

    Thanks!
  • Well first you would need to append tipContent to somewhere on the page using
    $(element).append(tipContent);


    Then you'll just need to target the element as normal

    $(".tippyTip").hide()
  • oh durr, thanks mate