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

标签 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>

最佳答案

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

http://jsfiddle.net/bQLPt/

关于JQuery解析html(查找非标准元素),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9370614/

相关文章:

java - Tomcat 中的 Geoserver 跨域

javascript - 无法更改 OpenLayers 标记图标

event-handling - 无法在 openlayers 中取消注册点击事件

javascript - jQuery 需要帮助选择具有特定类的 div 元素内的 tr 元素

javascript - 将 DragScroll 添加到 slider

javascript - Openlayers WKT 返回太大的 GPS 坐标

google-maps - 使用自己的图层打印 map

javascript - 为什么图像不占据页面的整个高度?

jquery - 如何使2个div标签彼此相邻

javascript - 如何使用 Ajax 和 JSON 制作下拉菜单?