Skip to content

Commit

Permalink
added enter button key board functinality of chatbot massege send sec…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Nayan2003 committed Nov 10, 2024
1 parent 14f092b commit a09422f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions chatbot.html
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,14 @@
recognition.addEventListener('error', (event) => {
console.error('Speech recognition error:', event.error); // Log any errors
});

document.getElementById("prompt-input").addEventListener("keypress", function(event) {
if (event.key === "Enter") {
event.preventDefault(); // Prevents the default action of the Enter key
document.getElementById("generate-btn").click(); // Programmatically clicks the send button
}
});

</script>
</body>

Expand Down

0 comments on commit a09422f

Please sign in to comment.