Grow your CSS skills. Land your dream job.

Turn variables into jQuery objects

  • # July 4, 2011 at 4:06 pm

    Hey everybody,

    how would i turn something like this

    var elemTitle = $(this).attr('title');
    var tipContent = '
    '+elemTitle+'
    ';

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

    Thanks!

    # July 5, 2011 at 3:48 am

    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()
    # July 8, 2011 at 3:45 am

    oh durr, thanks mate

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".