Treehouse: Grow your CSS skills. Land your dream job.

Wrap around specific word with jQuery

  • # March 28, 2012 at 4:21 pm

    I thought this would be easy but I am having trouble getting it, this is my HTML:

    Sat Mar 31 2012

    Unfortunately, I don’t have any control over this output, this is just the way it is. I want to wrap a around the date specifically so that I can style it with CSS, what would be the best way to do that? Please note, the date will change anywhere from the 1-31 so maybe all the dates would have to be in an array?

    Thank you in advance for your help.

    # March 29, 2012 at 8:29 am

    Is the date already wrapped in an H2? Or are you sharing the desired result?

    Could you please share a bit more HTML. It might be possible to use the HTML around the date to target it specifically or at least focus in on it. I’m thinking a replace regex would work, so you wouldn’t need an array of all dates.

    # March 29, 2012 at 8:21 pm

    How is the date being generated?

    # March 31, 2012 at 12:32 pm

    “How is the date being generated?”

    Something like:

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

You must be logged in to reply to this topic.