Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

what to write to add src to image?

I have been trying to add src to the image for a long time, but nothing works for me =(
How to create js src for an image? Image tag and class are there, but its src is not?

let child_block = document.querySelector('.child_block');

let xep = document.createElement('img');              
xep.className = 'img_s';
child_block.prepend(xep);
body{
display:grid;
place-items:center;     
user-select:none;
}


.main_block{
display:grid;
place-items:center; 
border:1px solid black;
width: 50%;
height:500px;
margin:50px;

}

.img_s{
width:100%;
border:1px solid red;
}

.child_block{

width:50%;
height:50%;     
}
<div class = "main_block">

<div class = "child_block">


</div>

</div>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

It should be xep.src = "https://example.com"

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading