【发布时间】:2014-10-10 17:16:45
【问题描述】:
我想替换标签<a>内的文本(“My Text”)
这是我的代码:
<a id="myID" href="#">
My Text
<img src="/layout/images/blank.gif">
</a>
我试过了:
$( "#myID" ).text( "New Text" );
但我返回此错误:
TypeError:字符串不是函数
消息:“字符串不是函数”
堆栈:(...)
获取堆栈:function () { [本机代码] }
set stack: function () { [native code] }
proto: Error
和:
$( "#myID" ).html( "New Text" );
类型错误:未定义不是函数
消息:“未定义不是函数”
堆栈:(...)
获取堆栈:function () { [本机代码] }
set stack: function () { [native code] }
proto: Error
【问题讨论】: