它只工作了几秒钟,然后 div 再次消失:
$(document).ready(function () {
$("#done").click(function () {
$('#txtname').replaceWith(function () {
return '<div>' + $(this).val() + '</div>';
});
});
.aspx
<asp:TextBox ID="txtname" runat="server" BorderColor="#96A6C5" CssClass="txt"></asp:TextBox></div>
<div class="text">
<asp:Button ID="done" runat="server" onclick="done_Click"/>
</div>
。CS
protected void done_Click(object sender, EventArgs e)
{
}