When i call $('#someelement').focus() it doesn't give any error message but practically not working. When i try to get document.activeElement it still returning body element.
Below is my console result:
When i call $('#someelement').focus() it doesn't give any error message but practically not working. When i try to get document.activeElement it still returning body element.
Below is my console result:
 
    
    You are calling .focus for #IncomeExpense_wrapper and that is <div> and div does not have focus event, only input elements does.
Can't help further, because you provide no info on what focusing on div must do.
 
    
    check this plunk it seems to be working fine.
<!DOCTYPE html>
<html>
  <head>
    <script data-require="jquery@3.0.0" data-semver="3.0.0" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>
  <body>
    <h1>Hello Plunker!</h1>
    <input type="text" />
    <script>
  $('document').ready(function(){
    $('input').focus();
  })
    </script>
  </body>
</html>
If you want to focus a div. i suggest you use this. you see, it scrolls down to the div in question.
<!DOCTYPE html>
<html>
  <head>
    <script data-require="jquery@3.0.0" data-semver="3.0.0" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>
  <body>
    <h1>Hello Plunker!</h1>
    <h1>Hello Plunker!</h1>
    <h1>Hello Plunker!</h1>
    <h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1><h1>Hello Plunker!</h1>
    <div id="somediv">this is the div</div>
    <script>
  $('document').ready(function(){
    window.location.hash = "#somediv";
  })
    </script>
  </body>
</html>
