I'm building a wordpress theme for a client who wants to pull their favorite songs from Hype Machine into the site. I'm doing by grabbing the XML feed.
In terms of styling the results though, I'd like to be able to style the Artist Name differently than the Song Title. Unfortunately, the feed includes both the Artist Name and Song Title in the same anchor elements as such:
<li>
<a href="link">Artist Name - Song Title</a>
</li>
<li>
<a href="link">Artist Name - Song Title</a>
</li>
I was wondering if there's a way I can insert span tags (with javascript or Jquery maybe) into the generated html so that the results are like:
<li>
<a href="link"><span class="artist">Artist Name - </span>Song Title</a>
</li>
<li>
<a href="link"><span class="artist">Artist Name - </span>Song Title</a>
</li>
My thought was that I could use a javascript to insert the open tag in front of the string then when it finds "- " insert the closing tag. I just don't know JS well enough to know how to do it and google hasn't been able to help much.
Thoughts?
Thanks!