Thursday, 15 January 2015

jQuery find img tag and get SRC from it -



jQuery find img tag and get SRC from it -

i have js code:

var imgjpg = jquery('img[src$=".jpg"]', '<div>' + fullcode + '</div>').attr('href');

however, not seem pick src of image?? fullcode html source code.

the html:

<strong><span style="font-size: small;"> <img class="alignleft" title="ashe" src="http://www.website.org/san-logo.jpg" alt="" width="198" height="192" />design (d) @ annual conference, held july 15-18, 2012 in san, florida.</span></strong>

am missing something?

you're retreveing 'href' instead of 'src'

var imgjpg = jquery('img[src$=".jpg"]', '<div>' + fullcode + '</div>').attr('src');

jquery

No comments:

Post a Comment