Answer the question
In order to leave comments, you need to log in
Jquery selection not working in SVG map?
Hello. This construction does not work: The
selection comes from this:
$("[title=russia]").attr('id','example');
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="1200" height="820" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"
<a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:title="russia" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><path fill="#ffffff" stroke="#3899e6" d="M1039.426,586.848C1038.897,587.1129999999999,1038.502,587.376,1038.2369999999999,587.5079999999999L1038.2369999999999,587.5079999999999L1038.2369999999999,587.5079999999999C1037.7099999999998,587.376,1035.86,588.3009999999999,1035.3329999999999,588.1689999999999C1034.8039999999999,588.1689999999999,1034.74.0619999999999,683.7570000000001,475.1189999999999C683.7570000000001,476.9679999999999,682.8320000000001,478.9489999999999,681.2470000000001,480.5329999999999C688.7750000000001,481.5899999999999,706.6060000000001,480.9289999999999,712.6800000000001,477.3629999999999C712.682,477.361,712.682,477.361,712.814,477.23ZM692.343,464.55H692.2099999999999C692.078,464.946,691.814,465.475,691.6819999999999,465.87C691.947,465.475,692.21,464.947,692.343,464.55Z" stroke-width="1" stroke-linejoin="round" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); stroke-width: 1px; stroke-linejoin: round;"></path></a>
</svg>
Answer the question
In order to leave comments, you need to log in
$("[*|title=russia]").attr('id','example');
But it won't work in IE versions up to and including 8 ( https://developer.mozilla.org/en-US/docs/Web/CSS/@... )
For xhtml it will probably work:
Here's what it says on this occasion W3:
<svg id="svg1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<video id="svgvideo1" xlink:href="myvideo.ogg" width="320" height="240"/>
<foreignObject width="100" height="100">
<video id="htmlvideo1" src="myvideo.ogg"
xmlns="http://www.w3.org/1999/xhtml">No video1</video>
</foreignObject>
</svg>
var elms = document.querySelectorAll("svg video");
var result = new Array();
var svgns = "http://www.w3.org/2000/svg"
for(var i = 0; i < elms.length; i++) {
if(elms[i].namespaceURI == svgns) {
result.push(elms[i]);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question