How to get the value of the input box that has gained focus

how to get the value of the input box that has gained focus

know that the input box has got the focus, how to get the value of the input box through its focus

Apr.23,2021

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" value="12">
    <input type="text" value="34">
    <button></button>
</body>
<script>
    window.onload = function () {
        let input = document.getElementsByTagName('input');
        for (let i = 0; i < input.length; iPP) {
            input[i].addEventListener('focus', (e) => {
                console.log(e.target.value);
            })
        }
    }
</script>

</html>

if it is the value, upstairs after the focus event is triggered, the answer should be all yes. If you just need an input value of focus, then the following code should be able to (written by jquery)

$('input:focus').val()

get yourself through this within the method
get the value this.value


you can get

through event.target.value in the focus event.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30a73-2bd2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30a73-2bd2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?