I am currently learning window.onload and document.onload as attributes on html. But i fail to use them properly. In my code i want to focus a specific text area named "emri", using the document.onload but without success. Some would say to use it as a script or smth, but i want to use it as an attribute inside the tag. What am i doing wrong?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> <link rel="stylesheet" href="App.css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous"> </head> <body onload="document.my-form1.emri.focus();" > <main class="my-form"> <div class="container"> <div class="row justify-content-flex-start"> <div class="col-md-6"> <div class="card"> <div class="card-header">Apliko</div> <div class="card-body"> <form name="my-form1" onsubmit=" return formValidation();"> <div class="form-group row"> <label for="emri" class="col-md-3 col-form-label text-md-right">Emri juaj:</label> <div class="col-md-6"> <input type="text" class="form-control" name="emri"> </div> </div>