function fun(obj){
$(obj).replaceWith("<input type='text' οnblur='nofun(this)' value='"+obj.innerHTML+"'/>");//节点替换,并传入值
}
function nofun(obj){
$(obj).replaceWith("<span οndblclick='fun(this)'>"+obj.value+"</span>");
}
<span οndblclick="fun(this)">内容1</span><a href="javascript:void(0)" οnclick="cg(this)">方法一</a></br>
<input type='text' style="border:0px;" value='内容2'/><a href="javascript:void(0)" οnclick="cg(this)">方法二</a>
<input type='button' οnclick='javascript:window.location.reload()' value='刷新'>