내가 마지막 문단 위에 마우스를 할 때 나는 내가 그것을 조금
<body>
<h4><i>More</i> Mitch Hedberg Quotes</h4>
<div>
<input type='submit' id='tmpQuote1' value='View Quote' />
</div>
<div>
<input type='submit' id='tmpQuote2' value='View Quote' />
</div>
<div>
<p id="paragraph"> some text that will disappear</p>
</div>
$(document).ready(
function() {
$('p').mouseover(
function(){
$(this).replaceWith("<p> the text changed to this text </p>");
}
);
$('input#tmpQuote1').click(
function($e) {
$e.preventDefault();
$(this).replaceWith(
"<p>\n" +
" I would imagine that if you could understand \n" +
" Morse code, a tap dancer would drive you crazy.\n" +
"</p>\n"
);
}
);
$('input#tmpQuote2').click(
function($e) {
$e.preventDefault();
$(this).replaceWith(
"<p>\n" +
" I'd like to get four people who do cart wheels \n" +
" very good, and make a cart.\n" +
"</p>\n"
);
}
);
을 수정 jQuery를 배우고 사용하고 책에서이 HTML 코드는 기본적으로 텍스트를 변경있어 . 두 버튼을 클릭하면 문단 + 텍스트로 바뀝니다. 지금까지 그렇게 좋았습니다. 그러나 내가 가지고있는 문제는 첫 번째 & (새로 스폰 된) 단락 위로 마우스를 가져 가면 마우스 오버가 작동하지 않는 이유를 이해하는 것입니다. Jquery 파서에 지연이 있습니까? 아니면 정확히 어떻게 작동하는지 모르겠습니다.
감사합니다.
감사합니다. – Marin