If you called .triggerHandler() on a focus event - the browser's default focus action would not be triggered, only the event handlers bound to the focus event.
<title>triggerHandler demo</title>
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<button id="old">.trigger( "focus" )</button>
<button id="new">.triggerHandler( "focus" )</button><br><br>
<input type="text" value="To Be Focused">
$( "#old" ).on( "click", function() {
$( "input" ).trigger( "focus" );
$( "#new" ).on( "click", function() {
$( "input" ).triggerHandler( "focus" );
$( "input" ).on( "focus", function() {
$( "<span>Focused!</span>" ).appendTo( "body" ).fadeOut( 1000 );
Web hosting by Digital Ocean
|
CDN by Fastly
|
Powered by WordPress