JQuery获取非标准html标记

JQuery获取非标准html标记,jquery,openlayers,Jquery,Openlayers,这可能吗 你少了一个括号 你少了一个括号 是的,这是可能的 您的示例代码不起作用,因为缺少一个右括号 是的,这是可能的 您的示例代码不起作用,因为缺少一个右括号 .您没有关闭if语句 你没有结束你的if陈述 你能更清楚地知道你想做什么,清理你的代码,使它至少没有语法错误吗?你能更清楚地知道你想做什么,清理你的代码,使它至少没有语法错误吗? if ($('svg image[href="Images/pin_icon_red_unit.png"]').length { alert("red");

这可能吗


你少了一个括号


你少了一个括号

是的,这是可能的

您的示例代码不起作用,因为缺少一个右括号

是的,这是可能的

您的示例代码不起作用,因为缺少一个右括号


.

您没有关闭if语句


你没有结束你的if陈述


你能更清楚地知道你想做什么,清理你的代码,使它至少没有语法错误吗?你能更清楚地知道你想做什么,清理你的代码,使它至少没有语法错误吗?
if ($('svg image[href="Images/pin_icon_red_unit.png"]').length {

alert("red");     

 }



<svg id="OpenLayers.Layer.Vector_179_svgRoot" width="1556" height="556" viewBox="0 0 1556 556"><g id="OpenLayers.Layer.Vector_179_root" style="display: block; visibility: visible; " transform=""><g id="OpenLayers.Layer.Vector_179_vroot"><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><image id="OpenLayers.Geometry.Point_240" cx="906" cy="406" r="1" preserveAspectRatio="none" x="886" y="386" 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><image id="OpenLayers.Geometry.Point_242" cx="1034" cy="534" r="1" preserveAspectRatio="none" x="1014" y="514" 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></g><g id="OpenLayers.Layer.Vector_179_troot"></g></g></svg>​
if ($('svg image[href="Images/pin_icon_red_unit.png"]').length) {