내 js 스크립트에 약간의 문제가 있습니다. 완벽하게 실행되지만 브라우저에서 무한대처럼 실행 단계에 있습니다. 브라우저가 멈추지 않습니다.jquery를 사용하여 사용자 정의 속성 변경 콘텐츠
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<p MyTag="home_id">home</p>
<p>33333333333</p>
<p MyTag="content_id">Content</p>
<script>
$(document).ready(function(){
var a = 'New text';
$('[MyTag]').each(function(index) {
document.write(index + ': ' + a + "<br>");
});
});
</script>
</body>
</html>
전역 수준에서 완전히 새로운 속성을 만드는 대신 데이터 속성을 사용해보십시오. http://www.w3schools.com/tags/att_global_data.asp – gpgekko