5
我有這樣的代碼片段:如何用腳本元素移動元素而不用jQuery重新執行腳本?
<div id="div1">
</div>
<div id="div2">
<h3>This is the content</h3>
<script type="text/javascript">
alert('This is the content');
</script>
</div>
<script type="text/javascript">
jQuery('div#div2').appendTo('div#div1');
</script>
使用此代碼,將顯示兩次(警報消息一旦當頁面正在加載,然後當jQuery的重新執行,當執行appendTo方法腳本
?如何使用jQuery方便移動元素(即有腳本標籤)左右,而無需重新executin?
感謝。