diff --git a/03_js-dom/uebungen/u15_tasse-01001/index.html b/03_js-dom/uebungen/u15_tasse-01001/index.html index 78bb0f8..34136cf 100644 --- a/03_js-dom/uebungen/u15_tasse-01001/index.html +++ b/03_js-dom/uebungen/u15_tasse-01001/index.html @@ -1,4 +1,4 @@ - + @@ -103,7 +103,18 @@ // 1. Füge in der Liste der Product Specifications mithilfe von JavaScript folgenden Listenpunkt hinzu: // Capacity: 11 oz. + const newItem = document.createElement('li'); + newItem.textContent = 'Capacity: 11 oz.'; + const listProductSpecification = $('#product_specification'); + listProductSpecification.append(newItem); + // 2. Erweitere die Select-Box neben dem buy-Button mithilfe von JavaScript um den Eintrag: 5 items. + + const formBuy = $('#buy_form'); + const selectEl = formBuy.querySelector('select'); + const newOption = document.createElement('option'); + newOption.textContent = '5 items'; + selectEl.append(newOption); } diff --git a/03_js-dom/uebungen/u16_tasse-01001/index.html b/03_js-dom/uebungen/u16_tasse-01001/index.html index 58d8753..58c6cda 100644 --- a/03_js-dom/uebungen/u16_tasse-01001/index.html +++ b/03_js-dom/uebungen/u16_tasse-01001/index.html @@ -1,4 +1,4 @@ - + @@ -101,8 +101,15 @@ // Verändere erneut die Produktseite der Binär-Tasse mithilfe von JavaScript. Du kannst auch hier wieder die JS-Konsole verwenden. // 1. Entferne die Überschrift Description mit der remove-Methode. + // Die erste h2-Überschrift im main-Bereich ist Description. + $('main h2').remove(); + // $('main h2').parentNode.removeChild($('main h2')) // 2. Entferne mit der remove-Methode den Text "010010000100111101010100" aus der Hauptüberschrift. + // Der Binärtext steht in einem eigenen span innerhalb der Hauptüberschrift. + + $('h1.article .keyword').remove(); + // $('h1.article .keyword').parentNode.removeChild($('h1.article .keyword')); } diff --git a/03_js-dom/uebungen/u17_tasse-01001/index.html b/03_js-dom/uebungen/u17_tasse-01001/index.html index 5b9ded8..50650fc 100644 --- a/03_js-dom/uebungen/u17_tasse-01001/index.html +++ b/03_js-dom/uebungen/u17_tasse-01001/index.html @@ -1,4 +1,4 @@ - + @@ -101,10 +101,37 @@ // Verändere die Produktseite der Binär-Tasse mithilfe von JavaScript. // Füge noch einmal den folgenden Listenpunkt zur Liste der Product Specifications hinzu: + const li = document.createElement('li'); + li.textContent = 'Capacity: 11 oz.'; // Capacity: 11 oz. // Füge den Listenpunkt aber dieses Mal nicht am Ende der Liste ein, sondern vor dem Eintrag Materials: Ceramic. + + $('#product_specification').insertBefore(li, $$('#product_specification li')[4]); + + $$('#product_specification li')[4].before(li); + + // DOM Traversal Befehle + document + .getElementById('product_specification') + .lastElementChild // + .previousElementSibling.before(li); + + document.getElementById('product_specification').children[4].before(li); + + // Element suchen + const foundListItem = $$('#product_specification li').find((el) => { + return el.textContent.trim().includes('Materials: Ceramic'); + }); + + foundListItem && foundListItem.before(li); + + const foundListItemIdx = $$('#product_specification li').findIndex((el) => { + return el.textContent.trim().includes('Materials: Ceramic'); + }); + + foundListItemIdx !== -1 && $(`#product_specification li:nth-child(${foundListItemIdx} )`).before(li); } diff --git a/03_js-dom/unterricht/tag23/03_product-manager/assets/js/main.js b/03_js-dom/unterricht/tag23/03_product-manager/assets/js/main.js index f5923b5..e77bf66 100644 --- a/03_js-dom/unterricht/tag23/03_product-manager/assets/js/main.js +++ b/03_js-dom/unterricht/tag23/03_product-manager/assets/js/main.js @@ -166,7 +166,7 @@ const createBtn = (options = {}) => { const { - classNames = [], + classNames = ['btn-primary'], iconName = 'circle', label, clickHandler = (e) => { diff --git a/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-creation.html b/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-creation.html new file mode 100644 index 0000000..8111bbb --- /dev/null +++ b/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-creation.html @@ -0,0 +1,49 @@ + + + + + + DOM Creation + + + +
+
+

DOM Creation

+
+ +
+
+ + + diff --git a/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-manipulation.html b/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-manipulation.html new file mode 100644 index 0000000..b1253e2 --- /dev/null +++ b/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-manipulation.html @@ -0,0 +1,107 @@ + + + + + + DOM Manipulation + + + +
+
+

DOM Manipulation

+
+ +
+
+ + + diff --git a/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-selection.html b/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-selection.html new file mode 100644 index 0000000..0d7bdeb --- /dev/null +++ b/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-selection.html @@ -0,0 +1,53 @@ + + + + + + DOM Selection + + + +
+
+

DOM Selection

+
+ + +
+
+ + + diff --git a/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-traversal.html b/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-traversal.html new file mode 100644 index 0000000..c606346 --- /dev/null +++ b/03_js-dom/unterricht/tag24/01_dom-bereiche/dom-traversal.html @@ -0,0 +1,65 @@ + + + + + + DOM Traversal + + + +
+
+

DOM Traversal

+
+ + +
+
+ + +