forked from HackYourFuture/Assignments
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathex3-hijackLogo.js
More file actions
18 lines (17 loc) · 827 Bytes
/
ex3-hijackLogo.js
File metadata and controls
18 lines (17 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*------------------------------------------------------------------------------
Full description at: https://github.com/HackYourFuture/Assignments/tree/main/2-Browsers/Week1#exercise-3-the-logo-hijack
1. Find out how to select the element that contains the Google logo, and store
it in a variable.
2. Modify the `src` and `srcset` of the logo so that it's replaced by the
HackYourFuture logo instead.
------------------------------------------------------------------------------*/
function hijackGoogleLogo() {
const logo = document.querySelector('svg.lnXdpd');
const hyfLogo =
'https://github.com/HackYourFuture/Assignments/raw/main/assets/hyf-logo-black-bg-small.png';
const img = document.createElement('img');
img.src = hyfLogo;
img.srcset = hyfLogo;
logo.replaceWith(img);
}
hijackGoogleLogo();