Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save madhoshyagnik/be96f4915c44af61e01aaa0a6d948e30 to your computer and use it in GitHub Desktop.
Save madhoshyagnik/be96f4915c44af61e01aaa0a6d948e30 to your computer and use it in GitHub Desktop.
const para = document.querySelector('p');
// para.innerText += 'ninjas are awesome';
// console.log(para.innerText);
const paras = document.querySelectorAll('p');
// paras.forEach(element => {
// element.innerText += ' new text';
// console.log(element.innerText);
// });
const content = document.querySelector('.content');
const people = ['mario', 'luiji', 'yoshi'];
people.forEach(element => {
content.innerHTML += `<p> ${element}</p>`;
});
@madhoshyagnik
Copy link
Author

madhoshyagnik commented Apr 14, 2024

image

@madhoshyagnik
Copy link
Author

const link = document.querySelector('a');

link.setAttribute('href', 'https://www.netninja.dev');

link.innerText = 'The net ninja uk website';

console.log(link.getAttribute('href'));

const mssg = document.querySelector('p');
console.log(mssg.getAttribute('class'));

mssg.setAttribute('class', 'success');
console.log(mssg.getAttribute('class'));

mssg.setAttribute('style', 'color: green;');

@madhoshyagnik
Copy link
Author

//adding css on top

const title = document.querySelector('h1');

console.log(title.style.color)

title.style.margin = '50px';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment