JQuery解析html(寻找非标准元素)

时间:2012-02-21 00:46:09

标签: jquery openlayers

我想用href = Images / pin_icon_red_unit.png来解析寻找。

var myParse = $('svg').html()
innerSearch = myParse.find( "image" ).attr("[href="Images/pin_icon_red_unit.png"]");

<svg id="OpenLayers.Layer.Vector_179_svgRoot" width="1556" height="556" viewBox="0 0 1556 556"><image id="OpenLayers.Geometry.Point_238" cx="778" cy="278" r="1" preserveAspectRatio="none" x="758" y="258" width="40" height="40" href="Images/pin_icon_red_unit.png" style="opacity: 1" fill="#000000" fill-opacity="1" stroke="#000000" stroke-opacity="1" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="none" pointer-events="visiblePainted"></image></svg>

1 个答案:

答案 0 :(得分:3)

$('svg image[href="Images/pin_icon_red_unit.png"]');

http://jsfiddle.net/bQLPt/