0
attr() 함수를 사용하여 xml doucment에서 속성을 가져올 수 있어야합니다. 그렇다면 왜 아래의 두 줄은 나를 정의되지 않은 상태로 되돌려 놓을까요? 나는시) parseXML (대한 JQuery와 문서의 샘플 코드를 추가 한 : http://api.jquery.com/jquery.parsexml/jquery XMLDocument의 속성을 가져올 수 없습니다.
console.log("Attributes: " + $xml.attributes);
console.log("Attr: " + $xml.attr('version'));
전체 페이지는 다음과 같습니다
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery.parseXML demo</title>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<p id="someElement"></p>
<p id="anotherElement"></p>
<script>
var xml = $.parseXML("<rss version='2.0'><channel><title>RSS Title</title></channel></rss>");
console.log("Attributes: " + $(xml).attributes);
console.log("Attr: " + $(xml).attr('version'));
</script>
</body>
</html>
을 극복한다. – Slime
구문 상 올바로 사용됩니다. Jquery 웹 사이트에서 직접 가져 왔습니다. 그 부분은 문제가되지 않습니다. 두 개의 console.log() 문과 그 이상을 추가했습니다. – user79074
기술적으로 올바르더라도 혼란 스럽습니다. 왜 그걸 할거야? – DLeh