내가 JQuery와 함께 일하고 내 문제는 apped 방법과 관련이정지 추가 요소 jQuery를
문제는
이 링크http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_html_append
로 이동 텍스트 추가를 클릭 정직 .it 버튼을 클릭 할 때마다 텍스트를 계속 추가합니다. 한 번에이 작업을 중단 할 수있는 방법은 무엇입니까?
여기에 코드
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#btn1").click(function(){
$("p").append(" <b>Appended text</b>.");
});
$("#btn2").click(function(){
$("ol").append("<li>Appended item</li>");
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<ol>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ol>
<button id="btn1">Append text</button>
<button id="btn2">Append list items</button>
</body>
</html>
될 것 W3 스쿨 끔찍한 자원이다. 사용을 중지하십시오. 대신 MDN –