<!DOCTYPE HTML> | |
<html class="focus-within"> | |
<head> | |
<style> | |
* { | |
border: none; | |
} | |
.focus-within { | |
border: 2px solid green; | |
} | |
</style> | |
</head> | |
<body class="focus-within"> | |
<div class="focus-within"> | |
<input> | |
<input> | |
<input> | |
<input class="focus-within"> | |
<input> | |
<input> | |
<input> | |
</div> | |
<script> | |
let midInput = document.getElementsByTagName("input")[3]; | |
midInput.focus(); | |
</script> | |
</body> | |
</html> |