<a class="but-arrow" href="">
<img class="svg" src="img/icons/arrow.svg" alt="" />
</a>
function svg() {
$('img[src$=".svg"]').each(function () {
var $img = $(this)
var imgURL = $img.attr('src')
var attributes = $img.prop('attributes')
if ($img.hasClass('svg')) {
$.get(
imgURL,
function (data) {
var $svg = jQuery(data).find('svg')
$svg = $svg.removeAttr('xmlns:a')
$.each(attributes, function () {
$svg.attr(this.name, this.value)
})
$img.removeClass('svg').replaceWith($svg)
},
'xml'
)
}
})
}
svg()
<svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4.07812 13.9866L5.25812 15.1666L11.9248 8.49998L5.25812 1.83331L4.07812 3.01331L9.56479 8.49998L4.07812 13.9866Z" fill="#868686"/>
</svg>
HTML in arrow.svg
What does the colon and :a mean here in $svg.removeAttr('xmlns:a')
? Represents a namespace?
I know that the jQuery event has a dot "." to represent the namespace, but I have never seen a colon.