任何人都知道如何让onKeyUp函数在我的PHP echo中工作?试图获取onKeyPress ="返回taLimit(this)" onKeyUp ="返回taCount(this,' myTextCounter')"在我的回音输入中工作。 ' myTextCounter'给我带来了麻烦。
提前致谢!
echo '<input onKeyPress="return taLimit(this)" onKeyUp="return taCount(this,'myTextCounter')" type="text" name="description" id="description" value="'.$description.'" />'
答案 0 :(得分:1)
正如语法高亮显示,您需要转义单引号:
echo '<input onKeyPress="return taLimit(this)" onKeyUp="return taCount(this,\'myTextCounter\')" type="text" name="description" id="description" value="'.$description.'" />'