I was trying to follow this question but it's not quite working for me
Load src content to SVG image dynamically
I created some code on jsfiddle http://jsfiddle.net/sLXCr/
Basically, I am trying (but neither seem to work)...is it a selector issue?
$('.graphlink').attr('xlink:href', "#");
document.querySelector('.graphlink').setAttributeNS('http://www.w3.org/1999/xlink', 'href', "#");
This is the minimized version of my code and I am trying to select all of the class="graphlink" as I want to change all the a href stuff to # and then I also after that want to register an onclick handler to all of those a ref that pops up the same modal for all of them(the modal is static information is all).
hmmmmm, I should mention I am using D3 and maybe there is a way to do it with that in that I want to add a class style but I have optional code that runs on some pages and not others to change all the href...maybe that is possible with D3 code instead?
My latest try with D3 didn't work :(
var refs = d3.selectAll('a');
refs.attr("xlink:href", function(d) { return "#"; });
I do see the above grabbing 24 a links but it's grabbing links I don't want but 'a.graphlink' seem to select nothing :(
thanks, Dean
grrrr,它与该代码无关,并且与不发布整个代码集无关(我认为其中有太多代码)。...结果是我的代码不在回调方法中,因此它可以运行太快了。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.