Upload an image and instant show or preview that image in html form

Here is the code below

<div>
    <label for="image" class="custom-file-label">Choose File</label>
    <input name="image" id="image" type="file" class="custom-file-input" accept="image/*"
    onchange="document.getElementById('output').src=window.URL.createObjectURL(this.files[0])">
</div>

<div class="col-12">
    <img id="output" src="" class="img-fluid">
</div>