I’m checking it, but please tell, what is happening? what should happen instead?
and where is the #more-info element? it’s going to be added there, because that’s what you have written
you have created #more-info in your html element, there you are just telling to put stuff in it when the button is pressed, it’s doing exactly what you have written
Here is one option. Add the details data to each .content element in the map. Put it inside an element and then show/hide the element using a class based on the button click. If you put the element below the button you can use event.target.nextElementSibling to target the element to show/hide.
We still generally don’t write code for others on this forum. I think you may have been told this once or twice. Is there a particular part of that description you don’t understand? What did you try? Did it work? If not, how so?
function newsData(obj) {
...
<div class="content">
<img src="${news.urlToImage}" />
<!-- instead of getElementById, -->
<!-- use the method that lasjorg suggested -->
<button id = "btnMore" onclick= "getElementById('moreInfo').innerHTML='author: ${news.author}<br> news title: ${news.title}<br> news description ${news.description} '" > More Details </button>
<!-- add a div/p/whatever element here with the text you want to display -->
</div>
</div>`
).join(''));
}
As said, you should post your code so we can see what you have tried. If I just post the code it will be a disservice to you. If after we have worked through your code you still need an example I can post some code.