Reputation: 6573
Given a document like this:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<body>
...
</body>
How can I read the xml:lang
attribute using jquery? I can query for elements that have xml:lang
like this:
$('[xml\\:lang]')
but I don't know how to get the attribute itself. attr('lang')
and attr('xml\\:lang')
don't work. I've a jsfiddle showing this here.
Upvotes: 4
Views: 390
Reputation: 816960
:
has only to be escaped in selectors, since they indicate the start of pseudo selectors. As attribute name you don't have to escape it:
.attr('xml:lang')
Upvotes: 2