Search code examples
javascriptjquerytwitter-bootstraptwitter-bootstrap-2

Not able to capture focus on desired element by js .focus()


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:

enter image description here


Solution

  • 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.