如何在文本区域上停止语音识别?

问题描述 投票:0回答:1

我有一个<textarea>,并且我不想允许我的用户在任何设备上使用语音识别。

我尝试了这种JQuery方法,但无法在iPhone或Chrome桌面上阻止语音识别。

$('#answerText').bind('webkitspeechchange',function(e) {
    console.log("Speech recognition is not allowed");
    e.preventDefault();
});
jquery speech-recognition speech-to-text
1个回答
0
投票

您可以尝试清空<textarea>元素,并在文本中显示一条消息,以免使用语音识别。

$('#answerText').bind('webkitspeechchange',function(e) {
$('#answerText').text("Speech recognition is not allowed. Please use the keyboard");
e.preventDefault();
});

这样,用户可以使用语音识别,但是结果不会显示在文本区域中。相反,他们会收到消息并知道您要他们使用键盘。

但是就像Rory McCrossan所说的那样,我不确定您是否要实现这一点,特别是在有特殊需求的用户中。

© www.soinside.com 2019 - 2024. All rights reserved.