jquery - How to select img src attribute inside a div? -
what selector need use src value of picture?
<div class="rg-image"> <img src="/zenphoto/cache/test2/6244146_460s_595_watermark.jpg"> </div>
there might better ways this, without seeing more of markup, recommend using this:
var img_src = $( '.rg-image > img' ).attr( 'src' );
this selector match <img>
tags within first level of element containing .rc-image
class.
note:
assumes there 1 <img>
element contained within 1 .rg-image
element. won't able retrieve multiple src
attributes in way selector match many elements. you'll need loop on matches , each 1 extract src
attribute.
Comments
Post a Comment