No problems found ...
You probably have some other code causing the trick.
Mark the snippet:
$("#password-reenter")
.attr('title','The passwords do not match. Please reenter thepassword.')
.css('border','3px solid red').focus();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input type="text" id="password-reenter" />
<input type="text" />
Run codeHide resultEDIT:
Looking at my code (this comment), I found the following:
<input type="password" name="password-reenter" id="password-reenter" onfocusout="checkpassword()" style="font-family: latine; border: 3px solid red;" required="" title="The passwords do not match. Please reenter the password.">
As you can see, the problem onfocusout="checkpassword()"is caused due to what it causes checkpassword(), which will focus again if the passwords do not match.
source
share