Reputation: 267
I have a small question about dojo: I have a div:
<div id="image" class="classImage">
<img src="abc.com/image1.jpg" />
</div>
my question is: how can i get the link abc.com/image1.jpg
inside that div:).
Thanks for suggestion!
Upvotes: 1
Views: 1492
Reputation: 1
You could also use another syntax which is more efficient
var img_node=query("img[src='abc.com/image1.jpg']");
by this way you've got all images whose source is abc.com/image1.jpg
Upvotes: 0
Reputation: 69964
You can choose one of the many ways to access that particular image node:
//Get the first image tag that is a child of the node
//with the "image" id:
var img_node = dojo.query('#image img')[0];
And then you can peek at the src
attribute to get the link
var link = dojo.attr(img_node, 'src');
Upvotes: 2