送信ボタンのクリックに基づいてイベントをまとめるのに問題があります。Chat.send()
私の目標は、ユーザーが「送信」ボタンを押したときに、ページ上部のフィールドにユーザーが入力して関数を実行することです。Chat.send()
繰り返しますが、ユーザーが送信ボタンをクリックしたときに、テキスト バーの文字列を渡したいと思います。私はこれにかなり慣れていないので、少し方向性を探しています。私はそれをハックしましたが、まったく機能していません..
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://chatbuilder.hackreactor.com/ChatBuilder.js"></script>
</head>
<body>
<script>
Chat.guide.start();
</script>
<h2>Borken Chat</h2>
<input class="draft" type="text"/> <button class="send" disabled>send</button>
<ul class="messages">
<script>
var Chat_Messages=[];
function fetchNew() {
var PrintChat=function(Chat_Messages){
var y=Chat_Messages.length;
for(i=0;i<y;i++){
Chat.display(Chat_Messages[i]);
}
}
Chat.fetch(PrintChat);
}
setInterval(fetchNew,3000);
/*
*$('#send').click(function(){
var Input=<input class="draft" type="text">
Chat.send(Input)
}) **This was my attempt. I was trying to use the "send" button to trigger an event that calls Chat.fetch on a variable that I was trying to define as the user input*/
</script>
</ul>
</body>
</html>