0

Replace image src without an ID tag on

How can I replace the image src and header which do not have an ID tag on. I can only edit the js and css file. <div id="funded_courses"> <img src="images/funded_courses.jpg"/> <h3>Header</h3> <div id="imageText" class="leftText spacing">The Credit .......</div> <hr/> <span id="image1" class="dot"></span> <span id="image2" class="dot"></span> <span id="image3" class="dot"></span> </div>

23rd Feb 2020, 7:33 AM
SWL
4 Answers
+ 1
document.querySelector('#funded_courses img').src = 'new.jpg';
23rd Feb 2020, 7:38 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 1
Thank you very much CalviŐ˛ ! How can I amend the <h3>Header<h3> part in javascript file? Many thanks in advance.
23rd Feb 2020, 7:43 AM
SWL
+ 1
Calviղ Thank you very much! Have been spending hours trying to solve based on the div ID😭
23rd Feb 2020, 8:41 AM
SWL
0
document.querySelector('#funded_courses h3').innerText = 'New text';
23rd Feb 2020, 8:11 AM
CalviŐ˛
CalviŐ˛ - avatar