diff --git a/homeworks/olena.ambitska_elena-ambitska/4-basics/basics.js b/homeworks/olena.ambitska_elena-ambitska/4-basics/basics.js new file mode 100644 index 00000000..dd12028f --- /dev/null +++ b/homeworks/olena.ambitska_elena-ambitska/4-basics/basics.js @@ -0,0 +1,30 @@ +const FIELD = document.getElementById('field'); +const FORM_SUBMIT = document.querySelector('.count__button'); + +function updateTemplate(num1, num2) { + const TEMPLATE = ` + +`; + + FIELD.innerHTML = ''; + FIELD.insertAdjacentHTML('beforeend', TEMPLATE); +} +FORM_SUBMIT.addEventListener('click', (e) => { + e.preventDefault(); + const num1 = document.querySelector('.counter__input--first').value; + const num2 = document.querySelector('.counter__input--second').value; + + if (num1 === '' || num2 === '') { + FIELD.innerHTML = '

Fill fields by numbers

'; + return; + } + + updateTemplate(+num1, +num2); +}); diff --git a/homeworks/olena.ambitska_elena-ambitska/4-basics/index.html b/homeworks/olena.ambitska_elena-ambitska/4-basics/index.html new file mode 100644 index 00000000..982d09d3 --- /dev/null +++ b/homeworks/olena.ambitska_elena-ambitska/4-basics/index.html @@ -0,0 +1,31 @@ + + + + + + + Basic JS + + +
+

Basic math operation

+
+
+ + +
+ +
+ + +
+ +
+ +
+
+
+
+ + + diff --git a/homeworks/olena.ambitska_elena-ambitska/4-basics/styles.css b/homeworks/olena.ambitska_elena-ambitska/4-basics/styles.css new file mode 100644 index 00000000..1c40a4e4 --- /dev/null +++ b/homeworks/olena.ambitska_elena-ambitska/4-basics/styles.css @@ -0,0 +1,25 @@ +.counter__section { + margin: 0 auto; + padding: 60px; +} + +.counter__section .section__title { + text-align: center; +} + +.count__button { + margin-top: 22px; +} + +.warning { + margin-top: 24px; + font-size: 26px; + line-height: 1.2; +} + +.counter__template { + margin: 20px auto; + display: flex; + flex-direction: column; + row-gap: 8px; +} diff --git a/homeworks/olena.ambitska_elena-ambitska/GamesProject/success.html b/homeworks/olena.ambitska_elena-ambitska/GamesProject/success.html index e9904450..b8914ef4 100644 --- a/homeworks/olena.ambitska_elena-ambitska/GamesProject/success.html +++ b/homeworks/olena.ambitska_elena-ambitska/GamesProject/success.html @@ -11,9 +11,9 @@
success unicorn image