Consider this code:
var input = document.getElementById("hello");
input.addEventListener('blur', function() {
alert('hello');
input.select();
input.focus();
});
<input type="text" value="hello" id="hello" />
Run codeHide resultThe idea around this is for the user to focus on the input until he / she enters the actual text into it. This is a simplified version of the code.
Js fiddle here: https://jsfiddle.net/wzwft49w/9/
Problem: If you focus on the input and then blur it, you will get an infinite warning popup in Chrome, but not in IE.
1. How would you solve this problem?
2. Any ideas on why this is happening?
Notes:
- I already checked this question, but this fix does not work in this case: Another question
- Chrome, ( , - , ): Chrome