里我似乎无法使用下面的代码href标记内得到IMG SRC路径:无法获得IMG SRC href标记
$(document).on('click', '.imagemodal', function() {
var imgsrc = $('img', this).attr("src");
alert("IMG: " + imgsrc);
});
我的HTML看起来像这样:
<a href="#" class="imagemodal"><img src="/images/psmith/5/image.jpg" /></a>
任何想法我失踪?
你已经关闭了你的锚链接? – undefined
工作在这里很好,即使缺少'':http://jsfiddle.net/xhhqU/ –
我已经......只是错过它,当我在 – Paul