What is the difference between onBlur and onChange attribute in HTML?

前端 未结 7 1364
[愿得一人]
[愿得一人] 2020-11-29 18:18

When is one called versus the other? Is there a situation were onChange would be called but onBlur would not be called?

相关标签:
7条回答
  • 2020-11-29 18:56

    onChange is when something within a field changes eg, you write something in a text input.

    onBlur is when you take focus away from a field eg, you were writing in a text input and you have clicked off it.

    So really they are almost the same thing but for onChange to behave the way onBlur does something in that input needs to change.

    0 讨论(0)
提交回复
热议问题