- Webiste Name: Dev To
- Query Selctory, Inner HTML
Target the Top description div and change the DEV Community to <Your_Name> and description to your passion
CODE:
document.querySelector(".side-bar .crayons-card .crayons-subtitle-2").innerHTML="Shakya";
document.querySelector(".side-bar .crayons-card .color-base-70").innerHTML="I Write Code";
- Website Name: Apple
CODE:
let mainDiv=document.querySelectorAll(".row .as-imagegrid-item a .as-imagegrid-item-title");
let storedArray=[];
for(let i=0;i<mainDiv.length;i++){
storedArray.push(mainDiv[i].textContent.split(" ")[0]);
}
console.log(storedArray);
['iPhone', 'Mac', 'iPad', 'Watch', 'AirPods', 'Music', 'TV']
- Webiste Name: Youtube Support
- Get Element By Id, Create Element, Create Text Node, Append Child
Add another FAQ 'My New FAQ' to the list
CODE:
let newNavItem=document.createElement("section");
newNavItem.classList.add("parent");
let newHeader=document.createElement("h3");
newHeader.textContent="My New FAQ";
newNavItem.appendChild(newHeader);
document.querySelector(".accordion-homepage").appendChild(newNavItem);
- Webiste Name: OnePlus
Query Selector, InnerText
Change the contact number
CODE:
document.querySelector(".customer-support .one-tel-number").innerText="+91 6366256689";
- Webiste Name: Samsung
getElementById, createElement, InnerText, append, setAttribute
Target the main div of card and change the Button text to Check out
CODE:
let buttons=document.querySelectorAll(".swiper-wrapper .feature-column-carousel__item .feature-column-carousel__feature .feature-column-carousel__content .feature-column-carousel__button .cta--contained");
for(btn of buttons){
btn.innerText="Check Out";
}
- Webiste Name: Adidas
- Query Selector, Event listeners, Changing Styles
Target the search box and on hover change thebackground color to red.
CODE:
let el=document.querySelector(".searchinput-wrapper___18TsX form .searchinput___zXLAR");
el.addEventListener("mouseover",()=>{
el.style.backgroundColor="red";
});
el.addEventListener("mouseout",()=>el.style.backgroundColor="#CAD5E2");
- Webiste Name: MDN Web Docs
Form, Value, Submit
To Search a topic in the MDN Search bar.
First add a text to search in the search bar and then hit the submit search button to search the docs using DOM
CODE:
function search(val) {
let input = document.querySelector("#top-nav-search-input");
input.value = val;
let form = document.querySelector("#top-nav-search-form");
form.submit();
}
let userInput=prompt("Enter the keyword you want to search");
search(userInput);
- Webiste Name: Google
Remove Elements
Remove alternate languages from the home page languages listed
CODE:
let languages=document.querySelectorAll("#SIvCob a");
for(let i=0;i<languages.length;i++){
if(i%2===0)
languages[i].remove();
}
- Webiste Name: Code Wars
Change Font Family, Color of Text.
Change the font family of the text to monospace and text color to the logo’s background color.
CODE:
document.querySelector(".display-heading-1").style.color="#b1361e";
document.querySelector(".display-heading-1").style.fontFamily="monospace";
- Webiste Name: Freecodecamp
querySelector, mouseover, click eventListener, callback function, style,
Target the button and change background colour on mouseover
CODE:
let btn=document.querySelector(".btn-cta-big .login-btn-text");
btn.addEventListener("mouseover",()=>btn.style.backgroundColor="red");
- Webiste Name: realme
querySelector,style,background-image
change the realme logo to ineuron logo
CODE:
document.querySelector(".logo span").style.backgroundImage="url(https://ineuron.ai/images/ineuron-logo.png)";
- Webiste Name: Github
querySelector,style,background-Color
change the background colour of the button to blue.
CODE:
document.querySelector(".f4 a").style.backgroundColor="blue"
- Webiste Name: Hackerrank
querySelector,innerHtml
Target the top description and change “Matching developers with great companies” to “JSBOOTCAMP“.
CODE:
document.querySelector(".fl-heading-text").innerHTML="JSBOOTCAMP"
- Webiste Name: Asus
querySelector,style,font-size
change the fontsize of “Hot Deals” to 80px
CODE:
document.querySelector(".HotDealsAll__Heading__2fIbe").style.fontSize="80px"
- Webiste Name: Dell
querySelector,style.textAlign
Convert the text “G15 Gaming Laptop” from left to right
CODE:
const texts= document.querySelectorAll(".ps-title");
texts.forEach((text)=>{text.style.textAlign = "right";});
- Webiste Name: Vercel
querySelector,innerHTMl
change the heading “Start with the developer” to “Start with Scratch”
CODE:
document.querySelector(".section-title_title__VEDfK").innerText="Start with Scratch";
- Webiste Name: Sony
querySelector,innerHTMl
change the button text To current Date.
CODE:
const date = new Date();
document.querySelector('.btn-container').textContent = date;
- Webiste Name: Philips
querySelector,style,backgroundcolor
change the background colour blue to orange
CODE:
document.querySelector(".p-footer").style.backgroundColor="orange";
- Webiste Name: Canon
querySelector,src
extract the canon logo
CODE:
console.log(document.querySelector(".navbar-brand img").src)
- Webiste Name: Oppo
querySelector,style,color
Change the description colour black to orange
CODE:
document.querySelectorAll(".desc").forEach((el)=>el.style.color="orange");