2012-05-28 157 views

回答

5

使用此:

$('#test button').replaceWith('<span>new</span>') 
+0

請添加更多文字或細節 –

1

您可以使用replaceWith()方法:

$('#test button').replaceWith('<p>another element</p>') 
+0

這將替換所有'在 – Joseph

+0

頁面選擇button's可以改變的,當然。 – undefined

1

可以使用.replaceWith()方法來做到這一點。對於more

2

$('#test button:first').replaceWith('<span>new</span>')

0

解決方案

$('#test').find('button').replaceWith('<input type="text"/>'); 
alert($('#test').html());