diff --git a/01/app.js b/01/app.js index 1c9992e..e27f60d 100644 --- a/01/app.js +++ b/01/app.js @@ -1 +1,8 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); +const commentsItem = document.querySelector(".comments__item"); +const newWest = document.querySelector(".comments__item--newest"); + +if (commentsItem && newWest) { + const dataInfo = document.querySelectorAll("[data-info]") + console.log(`Znaleziono ${dataInfo.length}`) +}; diff --git a/02/app.js b/02/app.js index 1c9992e..4235183 100644 --- a/02/app.js +++ b/02/app.js @@ -1 +1,7 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); + +const links = document.querySelectorAll("[data-url]"); +links.forEach(link => { + const url = link.getAttribute("data-url"); + link.href = url; +}); \ No newline at end of file diff --git a/02/index.html b/02/index.html index 89a53f6..a397da7 100644 --- a/02/index.html +++ b/02/index.html @@ -11,7 +11,7 @@

Moje ulubione strony:

diff --git a/03/app.js b/03/app.js index c299ca3..de81dca 100644 --- a/03/app.js +++ b/03/app.js @@ -11,4 +11,17 @@ const buttonSettings = { color: '#444' }, text: 'Click me!', -} \ No newline at end of file +}; + +const button = document.createElement("button"); +for (const key in buttonSettings) { + button.setAttribute(key, buttonSettings.attr[key]); +}; + +for (const style in buttonSettings.css) { + button.style[style] = buttonSettings[style]; +}; + +button.textContent = buttonSettings.text; +const parentElement = document.querySelector(".parent-for-button"); +parentElement.appendChild(button); \ No newline at end of file diff --git a/04/app.js b/04/app.js index e6411e4..3353f61 100644 --- a/04/app.js +++ b/04/app.js @@ -2,7 +2,53 @@ console.log('DOM'); // struktura do wykorzystania w pętli const menuItems = [ - {text: 'start', url: '/'}, - {text: 'galeria', url: '/gallery'}, - {text: 'kontakt', url: '/contact'}, -]; \ No newline at end of file + { text: 'start', url: '/' }, + { text: 'galeria', url: '/gallery' }, + { text: 'kontakt', url: '/contact' }, +]; + +const nav = document.querySelector("nav"); +const ul = document.querySelector("ul"); + +nav.innerHTML = ` + +` +menuItems.forEach(link => { + const ul = document.querySelector("ul"); + const li = document.createElement("li"); + const a = document.createElement("a"); + a.href = link.url; + a.textContent = link.text; + li.appendChild(a); + ul.appendChild(li); +}); + +nav.appendChild(ul); + +// Utwórz poniższą strukturę menu za pomocą JS: + +// ``` +// +// ``` + +// Całość wstaw do elementu `