JSFiddle - React, Tailwind, and code Playground
HTML
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="5cm" height="3cm" viewBox="0 0 5 3">
<desc>Example link01 - a link on an ellipse
</desc>
<rect x=".01" y=".01" width="4.98" height="2.98" fill="none" stroke="blue" stroke-width=".03"/>
<a xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.w3.org">
<ellipse cx="2.5" cy="1.5" rx="2" ry="1" fill="red"/>
</a>
<a href="#"> woot</a>
</svg>
JavaScript
var $svg = $('svg');
var $elements = $('a[*|xlink]', $svg); // Select all a xlink attributes inside svg object
$elements.each(function(index, element) {
$(element).attr('class', 'my-new-class'); // force class attribute
});
console.log('svg', $svg);
console.log('elements', $elements, $elements[0]);