Question

How can I get the image url which embeded in below media: thumbnail tag ?

<link href="http://example.com" type="text/html">
<media:content>
<media:thumbnail url="http://example2.com/1.jpg" width="150" height="100"></media:thumbnail>
</media:content>
</link>

I am looking for something like

var link = tag.querySelectorAll('link')[0];
var media = link.querySelector('media:content');
var thumbnail= link.querySelector('media:thumbnail');
var url= thumbnail.getAttribute('url');

but obviousely querySelector could not retrieve the value of media:content

Was it helpful?

Solution

Simply to use attr

jsfiddle example

OTHER TIPS

$('media:thumbnail').attr('url');

This may help you

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top