下面的代碼中使用的指令replaceWith只改變目標內容一次。如果我發送任何其他對象,警報顯示適當的值,但不是div。「replaceWith」不改變內容
function identify (thisobj) {
alert(thisobj.value);
$("#test").replaceWith(thisobj.value);
}
目標元素如下所示。
<div id="canvas_container">
<div id="test">This is a test</div>
</div>
正在傳遞各種對象,每個對象都有不同的值。但是,儘管Alert()反映了正確的內容,但#Test只允許一次更改,然後永久保留該值。
謝謝大家的幫助 – DKean 2012-02-15 20:04:10