基于<标签

Find next image tag based on <a tag

本文关键字:标签 lt 基于      更新时间:2023-09-26

这是我的代码

<a target="_blank" href="http://www.home.test.com/test/redirector.jspx?      
action=ref&cname=EDITORIAL&ckey=2259303&cc=US&lc=eng&cmpid=MA41335AM"     
style=cursor:hand ;color: #ffffff ;text-decoration:none">
<img height="250" src="http://newsletters.tm.agilent.com/epsg/13MR/MCD-CID/11_CC_020783-   
N9322C/N9322C_Application.jpg" alt="Basic spectrum analyzer" style="padding 0 0 0    
 0;margin:0 0 0 0;"border="0"></a>

现在的问题是,我想找到基于href标记的img alt属性文本。它是动态生成的,所以它可以是任何东西。有没有任何方法可以找到href最近的img标记或href下一个img标记。。

直接子选择器将是这里最好的

$('a > img').attr('alt');