Mayilarun Mayilarun - 1 year ago 143
Javascript Question

jquery : focus to div is not working

After the ajax function is over. in success messages I'm focusing to the specific div. But it's not working. My code is here.

url:"<?php echo admin_url( 'admin-ajax.php' ); ?>",

This is the code is not working(Not focusing on the div:

Answer Source

you can use the below code to bring focus to a div, in this example the page scrolls to the <div id="navigation">

$('html, body').animate({ scrollTop: $('#navigation').offset().top }, 'slow');