Home >Web Front-end >JS Tutorial >Triggering and solving bugs in Firefox textarea input method_javascript skills

Triggering and solving bugs in Firefox textarea input method_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:28:101508browse

In Firefox, if a textarea gets focus and the input method is activated, such as Sogou input method, when typing the first pinyin of a Chinese character, if the background js modifies the value of the textarea at this time, then the textarea will It is cleared directly, as shown in the figure
Triggering and solving bugs in Firefox textarea input method_javascript skills
In this state, if js modifies the value of textarea, the bug will be triggered.

How to solve this problem?
After many attempts, I found that only when js modifies the value, the textarea loses focus. After modification, it can gain focus again. This bug also applies to input

Copy code The code is as follows:

$("#test").blur();
$("#test"). val('test');
$("#test").focus();
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn