Compare commits

...

2 Commits

Author SHA1 Message Date
75e3463ec7
add HTML # links 2022-03-27 09:50:41 +03:00
1c051fe813
add some scripts 2022-03-26 03:37:19 +03:00
6 changed files with 18 additions and 0 deletions

View File

@ -1,4 +1,5 @@
# HTML
- [favicons.html](favicons.html)
- [anchors.html](anchors.html) - Пример использования якоря на странице
- [humans.txt](humans.txt)

3
HTML/anchors.html Normal file
View File

@ -0,0 +1,3 @@
<p><a name="top"></a></p>
<p>...</p>
<p><a href="#top">Наверх</a></p>

View File

@ -5,6 +5,9 @@
- [Spread syntax](spread.js) - распаковка массива в аргументы
- [fetch](fetch.js) - ...
- [location.href](location.href.js) - Переход на другую страницу
- [Text Content](textContent.js) - Получить текстовое содержимое элемента
- [Add DOM Elements](addElements.js) - Добавление элементов в DOM
- [Add Class](addClass.js) - Добавление/Удаление классов
## Other
- [Webpack](webpack.md) example config

5
JavaScript/addClass.js Normal file
View File

@ -0,0 +1,5 @@
// Use element.classList.add to add a class:
element.classList.add('my-class');
// And element.classList.remove to remove a class:
element.classList.remove('my-class');

View File

@ -0,0 +1,3 @@
let newDiv = document.createElement('div');
newDiv.appendChild(document.createTextNode('some text'));
document.body.appendChild(newDiv);

View File

@ -0,0 +1,3 @@
document.getElementById('element').textContent;
// If you need to target < IE9 then you need to use
document.getElementById('element').innerText;