Hey all i am trying to get the png link from a string that houses some HTML in it.
The string looks like this:
var thecode = '[caption id="attachment_1794" align="alignleft" width="210"]
<a href="http://www.website.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-30-at-
8.52.48-AM.png"><img class="size-medium wp-image-1794" title="Difference between and
affiliate programs" src="http://www.website.com/wp-content/uploads/2012/10/Screen-
Shot-2012-10-30-at-8.52.48-AM-210x300.png" alt="Learn the and affiliate programs"
width="210" height="300" /></a> Learn the and affiliate programs[/caption]<p><span
style="font-size: small;">An article by CEO of AD, Inc. (AD®), has been published by
<a title="Learn the and affiliate programs" href="http://www.mmag.com/articles/85281"
target="_blank">M Magazine</a>. The article is titled: "Putting The Right Place." </span>';
I have been trying to get the image link via jQuery code:
var newString = $('a[href$=".png"]', thecode).attr('href');
console.log(newString);
But the example above returns back SCRIPT5022: Syntax error, unrecognized expression:
What would i be missing?