Use js to determine whether the control gets focus

  • 2020-03-30 01:13:40
  • OfStack

Use JS to get the ID with the focus control:


$("#textID").click(function(){
var act = document.activeElement.id;
if(act == "textID" ){
 alert("true");
}else{
 alert("false");
}
} );

Var act = $(document.activeelement).attr(" ID ");
  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- < Input type = "text" id = "textID >"


Related articles: