Horje
change photo with js Code Example
change photo with js
//ui
<form action="" method='post'>
  <img src="https://www.freeiconspng.com/uploads/no-image-icon-13.png" id="coverPreview" alt="">
  <input type="file" id="cover" />
</form>

//css
input{
  display:none;
}

//js
 let coverPreview = document.getElementById('coverPreview');
        let cover = document.getElementById('cover');

        coverPreview.addEventListener('click',_=>cover.click());

        cover.addEventListener("change",_=>{
            let file = cover.files[0];
            let reader = new FileReader();
            reader.onload = function (){
                coverPreview.src = reader.result;
            }
            reader.readAsDataURL(file);
        });




Javascript

Related
discord interaction Create not working Code Example discord interaction Create not working Code Example
waiting for the value from use effect Code Example waiting for the value from use effect Code Example
set-date-picker-range-with-in-a-financial-year-based-on-the-document Code Example set-date-picker-range-with-in-a-financial-year-based-on-the-document Code Example
a full express function Code Example a full express function Code Example
return Code Example return Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7