我正在建立一个支持聊天框插件,请点击this article
我的问题是当我点击提交按钮时,控制台显示错误“that.connectServer不是一个函数”,之后,当发送消息时,sendMsg功能未定义。
我花了很多时间找到解决方案,但我不能。我该如何解决?
我的支持聊天框:Fiddle
function eventListener() {
var that = this;
this.submitName.addEventListener("click", function () {
if (that.inputName.value.trim() !== "") {
writeCookie("client-name", that.inputName.value);
that.body.removeChild(that.inputName);
that.body.removeChild(that.submitName);
that.body.querySelector("p:not(.greeting)").innerHTML = "Success. Please input your message.";
that.connectServer().bind(that);
}
});