Collections
There are several ways of finding several elements on the page at once. Elements are written to a structure, which we call a collection. Collections work similarly to arrays, though they are something different from them. Collections of elements can be called by index, and you can sort them in the for loop, just like regular arrays.
The following are some of the ways of obtaining collections:
-
element.querySelectorAll() returns all of the elements that match the specified rule. This code is static, and the changes in DOM do not affect it whatsoever. We can say that querySelectorAll works like any other variable that we have written some value to. Until we redefine the variable, it will contain the value that we wrote to it, regardless of what happens in the code. Therefore, this collection is called static.
-
parentElement.children is called in the parent element, and it collects all of the child elements in a dynamic collection. These collections react to changes in DOM. If one of the elements in the collection is deleted from DOM, then it will also disappear from the collection.
Working with Elements
Removing an Element
There are various ways of removing elements from the page, of which one of the simplest is calling the remove method for the element that needs to be removed.
element.remove();
The method in the example above removes the element from DOM.
Cloning an Element
We can copy elements as many times as we like and insert them anywhere on the page using cloning. This what the cloneNode method is for. The syntax is as follows:
element.cloneNode(true);
// Will return a cloned element with all nested elements.
element.cloneNode(false);
// Will return a cloned element without nested elements.
element.cloneNode();
// 0_o
If you pass true as the argument, the element itself is cloned together with all of its nested elements. This type of cloning includes all attributes, classes, and the text contents of all nested elements. We call this deep cloning.
However, if you pass the value false as the argument, then the element itself with its classes and attributes will be cloned, but any child elements will be excluded.
It is best to always explicitly pass the argument to cloneNode to avoid any errors in the program operation.
How to Obtain Text from the Input Field
We need to call the property of the value input field. It stores information that has been entered in the field.
input.value;
The result can be saved as a variable and used later in the code.
Templates and the template Tag
The template tag stores a template for future elements. It is stored in the same place as the rest of the site markup, only its contents are not displayed on the page.
In order to obtain the template in JavaScript, you can find it by its identifier. This unique name is written to the id attribute. You can specify this attribute for various elements. The main thing is to follow the rule that the attribute value should not be repeated on the same page.
The template in the markup:
<body>
…
<template id="text-template">
<p class="text"></p>
</template>
</body>
Searching for an element in JavaScript:
document.querySelector('#text-template');
The hashtag in the querySelector parameter indicates that you need to search by id.
The document-fragment or just a code fragment is contained inside the template. It is the repository for the contents of the template tag. It is also the reason why the markup from the template is not displayed on the page.
In order to obtain the desired elements in the template, we need to call document-fragment. It is located in the content property so that we can continue to search for the desired elements using the usual search methods.
<body>
…
<template id="text-template">
<p class="text"></p>
</template>
</body>
If we want to find an element in the template, we need to perform the following search:
var template = document.querySelector('#text-template');
// A template was found in the document.
var content = template.content;
// We obtained the contents, a text fragment.
var text = content.querySelector('.text');
// We found the desired template.
We can shorten this code. For example, we can write the the content as one variable and the sought template as another variable.
var textTemplate = document.querySelector('#text-template').content;
var text = textTemplate.querySelector('.text');
Events
-
change is triggered when the state of the input field changes. For example, an unselected checkbox is selected or unselected.
-
submit responds to the form submission. Forms are sent by default in the same way as when you click on a link. The result is that you are directed to the specified address. If you don’t need to submit the form in some cases, then cancel the default action using preventDefault.
Continue
<!DOCTYPE html><html lang="en" class="no-js"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><script>var b=document.documentElement.classList;b.remove('no-js');if(!window.Promise||!window.sessionStorage||!!sessionStorage.getItem('muller.v2')){b.add('muller')}</script><link rel="dns-prefetch" href="https://assets.htmlacademy.org"><script async src="https://www.googletagmanager.com/gtag/js?id=G-MXPCRXM48C"></script><script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-MXPCRXM48C');
</script><script type="text/javascript">
(function(e,t){var n=e.amplitude||{_q:[],_iq:{}};var r=t.createElement("script")
;r.type="text/javascript"
;r.integrity="sha384-d/yhnowERvm+7eCU79T/bYjOiMmq4F11ElWYLmt0ktvYEVgqLDazh4+gW9CKMpYW"
;r.crossOrigin="anonymous";r.async=true
;r.src="https://cdn.amplitude.com/libs/amplitude-5.2.2-min.gz.js"
;r.onload=function(){if(!e.amplitude.runQueuedFunctions){
console.log("[Amplitude] Error: could not load SDK")}}
;var i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)
;function s(e,t){e.prototype[t]=function(){
this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));return this}}
var o=function(){this._q=[];return this}
;var a=["add","append","clearAll","prepend","set","setOnce","unset"]
;for(var u=0;u<a.length;u++){s(o,a[u])}n.Identify=o;var c=function(){this._q=[]
;return this}
;var l=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"]
;for(var p=0;p<l.length;p++){s(c,l[p])}n.Revenue=c
;var d=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties","setGroup","logRevenueV2","regenerateDeviceId","groupIdentify","onInit","logEventWithTimestamp","logEventWithGroups","setSessionId","resetSessionId"]
;function v(e){function t(t){e[t]=function(){
e._q.push([t].concat(Array.prototype.slice.call(arguments,0)))}}
for(var n=0;n<d.length;n++){t(d[n])}}v(n);n.getInstance=function(e){
e=(!e||e.length===0?"$default_instance":e).toLowerCase()
;if(!n._iq.hasOwnProperty(e)){n._iq[e]={_q:[]};v(n._iq[e])}return n._iq[e]}
;e.amplitude=n})(window,document);
amplitude.getInstance().init("df11525b6880a3c5e2af14f9b6238408", null,{
includeUtm: true,
includeGclid: true,
includeReferrer: true,
deviceIdFromUrlParam: true
}, function (instance) {
window.amplitudeLoaded = true;
});
</script><link rel="stylesheet" href="https://assets.htmlacademy.org/css/core.v284.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/profile.v236.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course.v246.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course-interface-light.v20.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course-interface-en.v2.css"><script src="https://assets.htmlacademy.org/js/sentry.js" data-sentry="3774884cc81746ed84c0ba7c5cd4ac7b" data-project="26" data-version="2"></script><link rel="stylesheet" href="/css/custom.css"><link rel="stylesheet" href="/css/cookies.css"><link rel="preload" as="script" href="https://assets.htmlacademy.org/js/general.v274.js"><title>Summary of “Actions with DOM” — Working with DOM — HTML Academy</title><meta name="csrf-token" content="60264caf322823086fca37a7326b9bd2a54"><meta property="og:type" content="website"><meta property="og:site_name" content="HTML Academy"><meta name="twitter:url" property="og:url" content="https://htmlacademy.org"><meta name="twitter:title" property="og:title" content="Interactive online courses HTML Academy"><meta name="twitter:description" property="og:description" content="Together we’ll learn how to work with real code, solve true-to-life problems, use cutting edge technologies. Minimum of boring theory and lots of practical tasks."><meta name="twitter:image" property="og:image" content="https://htmlacademy.org/og/htmlacademy.png"><meta name="twitter:card" content="summary_large_image"><link rel="canonical" href="https://htmlacademy.org/courses/javascript-browser/dom/summary"><meta name="theme-color" content="#2f358f"></head><body class="course-interface course-interface--light course-interface--full" data-base="/assets/courses/31/"><header class="page-header page-header--course"><div class="page-header__inner"><div class="page-header__top"><a class="page-header__logo" href="/" aria-label="HTML Academy Home"><img src="https://assets.htmlacademy.org/img/logo--small.svg?cs=1218aec0be4a5f23db79ad29a14e30f7f9fb9a25" width="24" height="36" alt="HTML Academy"></a><nav class="main-nav main-nav--mini" role="navigation"><div class="main-nav__course-nav"><a class="main-nav__course-item main-nav__course-button main-nav__course-button--prev" href="/courses/javascript-browser/dom/clear-input">Clearing the input field</a><div class="main-nav__course-item main-nav__course-list main-nav__course-list--collapsed"><b class="main-nav__course-title">Working with DOM</b><span class="main-nav__course-stat">22/23</span><div class="main-nav__course-contents"><a class="main-nav__course-contents-link" href="/courses/javascript-browser/dom">Back to the list of tasks</a><ul class="main-nav__course-contents-list"><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/to-do-list">1. What are you planning to do?</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/change-event">2. The “change” event</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/change-event-2">3. How the “change” event works</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/delete-element">4. Deleting the element from the list</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/check-collection-length">5. How to check the collection length</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/debug-code">6. Debugging the code</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/static-live-collection">7. Static and live collections</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/display-message">8. Displaying the message on the page</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/submit-event">9. The “submit” event</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/cancel-form-submit">10. Cancelling the form submission</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/obtain-text-input">11. How to obtain text from the input field</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/template-tag">12. Templates and the <template> tag</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/document-fragment">13. The contents of the <template> tag, document-fragment</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/clone-element">14. Cloning and inserting elements, part 1</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/clone-element-2">15. Cloning and inserting elements, part 2</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/clone-element-3">16. Cloning and inserting elements, part 3</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/clone-element-4">17. Cloning and inserting elements, part 4</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/clone-element-5">18. How to clone elements</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/add-new-element">19. Adding a new element to a list</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/delete-new-task">20. Deleting a new task in the list</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/clear-input">21. Clearing the input field</a></li><li class="main-nav__course-contents-item main-nav__course-contents-item--current"><a href="/courses/javascript-browser/dom/summary">22. Summary of “Actions with DOM”</a></li><li class="main-nav__course-contents-item"><a href="/courses/javascript-browser/dom/instant-messanger">23. The third program: “Instant messenger”</a></li></ul></div></div><a class="main-nav__course-item main-nav__course-button main-nav__course-button--next" href="/courses/javascript-browser/dom/instant-messanger">The third program: “Instant messenger”</a></div><ul class="main-nav__list main-nav__list--user main-nav__list--user-guest"><li class="main-nav__item" itemprop="name"><a class="main-nav__link" href="/signup?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" title="Sign up" data-modal="open" data-value="register" itemprop="url"><span class="main-nav__icon" aria-hidden="true"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#user"></use></svg></span>Sign up</a></li><li class="main-nav__item main-nav__item--login" itemprop="name"><a class="main-nav__link" href="/login?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" title="Log in" data-modal="open" data-value="login" itemprop="url"><span class="main-nav__icon" aria-hidden="true"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#login"></use></svg></span>Log in</a></li></ul></nav></div></div></header><main class="course-container"><div class="course-theory"><div class="course-theory__inner"><section class="course-theory__content"><h1 class="course-theory__content-heading course-theory__content-heading--synopsis">Summary of “Actions with DOM”</h1><div class="course-theory__content-text"><h2>Collections</h2><p>There are several ways of finding several elements on the page at once. Elements are written to a structure, which we call a <i>collection</i>. Collections work similarly to arrays, though they are something different from them. Collections of elements can be called by index, and you can sort them in the <code>for</code> loop, just like regular arrays.</p><p>The following are some of the ways of obtaining collections:</p><ul><li><b><code>element.querySelectorAll()</code></b> returns <b>all</b> of the elements that match the specified rule. This code is static, and the changes in DOM do not affect it whatsoever. We can say that <code>querySelectorAll</code> works like any other variable that we have written some value to. Until we redefine the variable, it will contain the value that we wrote to it, regardless of what happens in the code. Therefore, this collection is called static.</li><li><b><code>parentElement.children</code></b> is called in the parent element, and it collects all of the child elements in a <i>dynamic collection</i>. These collections react to changes in DOM. If one of the elements in the collection is deleted from DOM, then it will also disappear from the collection.</li></ul><h2>Working with Elements</h2><h3>Removing an Element</h3><p>There are various ways of removing elements from the page, of which one of the simplest is calling the <code>remove</code> method for the element that needs to be removed.</p><pre><code>element<mark>.remove()</mark>;</code></pre><p>The method in the example above removes the <code>element</code> from DOM.</p><h3>Cloning an Element</h3><p>We can copy elements as many times as we like and insert them anywhere on the page using cloning. This what the <code>cloneNode</code> method is for. The syntax is as follows:</p><pre><code>element.cloneNode(<mark>true</mark>);
// Will return a cloned element with all nested elements.
element.cloneNode(<mark>false</mark>);
// Will return a cloned element without nested elements.
element.cloneNode();
// 0_o
</code></pre><p>If you pass <code>true</code> as the argument, the element itself is cloned together with all of its nested elements. This type of cloning includes all attributes, classes, and the text contents of all nested elements. We call this deep cloning.</p><p>However, if you pass the value <code>false</code> as the argument, then the element itself with its classes and attributes will be cloned, but any child elements will be excluded.</p><p>It is best to always explicitly pass the argument to <code>cloneNode</code> to avoid any errors in the program operation.</p><h3>How to Obtain Text from the Input Field</h3><p>We need to call the property of the <code>value</code> input field. It stores information that has been entered in the field.</p><pre><code>input<mark>.value</mark>;</code></pre><p>The result can be saved as a variable and used later in the code. </p><h2>Templates and the template Tag</h2><p>The <code>template</code> tag stores a template for future elements. It is stored in the same place as the rest of the site markup, only its contents are not displayed on the page.</p><p>In order to obtain the <code>template</code> in JavaScript, you can find it by its identifier. This unique name is written to the <code>id</code> attribute. You can specify this attribute for various elements. The main thing is to follow the rule that the attribute value should not be repeated on the same page.</p><p>The template in the markup:</p><pre><code><body>
…
<mark><template id="text-template"></mark>
<p class="text"></p>
<mark></template></mark>
</body></code></pre><p>Searching for an element in JavaScript:</p><pre><code>document.querySelector('<mark>#text-template</mark>');
</code></pre><p>The hashtag in the <code>querySelector</code> parameter indicates that you need to search by <code>id</code>.</p><p>The <code>document-fragment</code> or just a code fragment is contained inside the <code>template</code>. It is the repository for the contents of the <code>template</code> tag. It is also the reason why the markup from the <code>template</code> is not displayed on the page.</p><p>In order to obtain the desired elements in the template, we need to call <code>document-fragment</code>. It is located in the <code>content</code> property so that we can continue to search for the desired elements using the usual search methods.</p><pre><code><body>
…
<template id="text-template">
<p class="text"></p>
</template>
</body></code></pre><p>If we want to find an element in the template, we need to perform the following search:</p><pre><code>var template = document.querySelector('#text-template');
// A template was found in the document.
var content = <mark>template.content</mark>;
// We obtained the contents, a text fragment.
var text = content.querySelector('.text');
// We found the desired template.</code></pre><p>We can shorten this code. For example, we can write the the content as one variable and the sought template as another variable.</p><pre><code>var textTemplate = document.querySelector('#text-template')<mark>.content</mark>;
var text = textTemplate.querySelector('.text');</code></pre><h2>Events</h2><ul><li><b><code>change</code></b> is triggered when the state of the input field changes. For example, an unselected checkbox is selected or unselected.</li><li><b><code>submit</code></b> responds to the form submission. Forms are sent by default in the same way as when you click on a link. The result is that you are directed to the specified address. If you don’t need to submit the form in some cases, then cancel the default action using <code>preventDefault</code>.</li></ul><br><a class="button button--green button--large button--wide button--icon" href="/courses/javascript-browser/dom/instant-messanger"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#icon-check-bold"></use></svg>
Continue
</a></div></section></div></div><script
src="https://assets.htmlacademy.org/scripts/courses-spa/htmlacademy-task.v43.js"
data-assets-path="https://assets.htmlacademy.org/scripts/courses-spa/"
data-task-type="theory"
data-lang="en"
></script><script>HtmlacademyTask.setup(function(){});</script></main><footer class="page-footer page-footer--tiny"><div class="page-footer__inner"><p><a href="/docs/cookies">Cookies</a> ∙
<a href="/docs/privacy">Privacy</a> ∙
<a href="/docs/agreement">License Agreement</a> ∙
<a href="/docs/about">About</a> ∙
<a href="/contacts">Contacts</a> ∙
© HTML Academy OÜ, 2019−2026
</p><div class="page-footer__financial"><img src="https://assets.htmlacademy.org/img/visa-white.svg?cs=96e54ec8c587db9d4b1d8d328ffd87c2ebfd9555" alt="VISA" title="VISA" width="35" height="35"><img src="https://assets.htmlacademy.org/img/mastercard-horizontal.v2.svg" alt="Mastercard" title="Mastercard" width="35" height="35"></div></div></footer><div class="modal"><div class="modal__inner"><div class="modal__wrapper js-login hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Log in</h4><ul class="modal__social"><li class="modal__social-link modal__social-link--fb"><a href="/login/fb?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" rel="nofollow" title="Log in via Facebook"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#facebook"></use></svg></a></li><li class="modal__social-link modal__social-link--google"><a href="/login/google?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" rel="nofollow" title="Log in via Google"><svg height="30" width="30" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M457.732 216.625c2.628 14.041 4.063 28.743 4.063 44.098C461.796 380.688 381.481 466 260.204 466c-116.023 0-210-93.977-210-210s93.977-210 210-210c56.704 0 104.077 20.867 140.44 54.73l-59.204 59.197v-.135c-22.046-21.002-50-31.762-81.236-31.762-69.297 0-125.604 58.537-125.604 127.841 0 69.29 56.306 127.968 125.604 127.968 62.87 0 105.653-35.965 114.46-85.312h-114.46v-81.902h197.528z"/></svg></a></li></ul><div class="modal__or"><span>or</span></div><form class="modal__form form" action="/login?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" autocomplete="off" method="post" data-submit="o"><input type="hidden" name="csrf_name" value="csrf69aea69db6496"><input type="hidden" name="csrf_value" value="a28250de59b7d7a201d1fa7bb7287bc5"><div class="form__group"><label class="sr-only" for="login-email">Email</label><input class="field field--text field--full-width" type="email" name="email" placeholder="Email" value="" id="login-email"></div><div class="form__group"><label class="sr-only" for="login-password">Password</label><input class="field field--text field--full-width ym-disable-keys" type="password" name="password" placeholder="Password" id="login-password"></div><input class="button button--full-width" type="submit" data-submit-text="Logging in…" value="Log in"></form><p class="modal__forgot-password"><a href="/recover" data-modal="open" data-value="recover">Forgot your password?</a></p><a class="modal__bottom-link" href="/signup" data-modal="open" data-value="register">Sign up</a></div><div class="modal__wrapper js-register hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Sign up</h4><ul class="modal__social"><li class="modal__social-link modal__social-link--fb"><a href="/login/fb?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" rel="nofollow" title="Log in via Facebook"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#facebook"></use></svg></a></li><li class="modal__social-link modal__social-link--google"><a href="/login/google?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" rel="nofollow" title="Log in via Google"><svg height="30" width="30" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M457.732 216.625c2.628 14.041 4.063 28.743 4.063 44.098C461.796 380.688 381.481 466 260.204 466c-116.023 0-210-93.977-210-210s93.977-210 210-210c56.704 0 104.077 20.867 140.44 54.73l-59.204 59.197v-.135c-22.046-21.002-50-31.762-81.236-31.762-69.297 0-125.604 58.537-125.604 127.841 0 69.29 56.306 127.968 125.604 127.968 62.87 0 105.653-35.965 114.46-85.312h-114.46v-81.902h197.528z"/></svg></a></li></ul><div class="modal__or"><span>or</span></div><form class="modal__form form" action="/signup?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" autocomplete="off" method="post"><input type="hidden" name="csrf_name" value="csrf69aea69db6496"><input type="hidden" name="csrf_value" value="a28250de59b7d7a201d1fa7bb7287bc5"><div class="form__group"><label class="sr-only" for="email">
Email
<span class="required"><span class="sr-only">Required field</span><span class="required__star">*</span></span></label><div class="form__group-fields"><input class="field field--text field--full-width" type="email" name="email" value="" id="email" required placeholder="Email"></div></div><div class="form__group"><label class="sr-only" for="password">
Password
<span class="required"><span class="sr-only">Required field</span><span class="required__star">*</span></span></label><div class="form__group-fields"><input class="field field--text field--full-width" type="password" name="password" value="" id="password" required placeholder="Password"></div></div><div class="form__group"><label class="checkbox"><input class="checkbox__input" type="checkbox" name="agreement" value="1" required><span class="checkbox__text"><span>By signing up, you agree to our <a href="/docs/agreement" target="_blank">License Agreement</a> and <a href="/docs/privacy" target="_blank">Privacy Policy</a>.</span></span></label></div><input class="button button--full-width" type="submit" data-submit-text="Signing up…" value="Sign up"></form><a class="modal__bottom-link" href="/login?redirect_url=%2Fcourses%2Fjavascript-browser%2Fdom%2Fsummary" data-modal="open" data-value="login">Log in</a></div><div class="modal__wrapper modal__wrapper--no-btn-bottom js-recover hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Restore access</h4><p class="modal__text-accent">Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.</p><form class="modal__form form" action="/recover" autocomplete="off" method="post" data-submit="o"><input type="hidden" name="csrf_name" value="csrf69aea69db6496"><input type="hidden" name="csrf_value" value="a28250de59b7d7a201d1fa7bb7287bc5"><div class="form__group"><label class="sr-only" for="recovery-email">Email</label><input class="field field--text field--full-width" type="email" name="email" placeholder="Email" value="" id="recovery-email"></div><script src='https://www.google.com/recaptcha/api.js'></script><div class="form__group"><div class="g-recaptcha" data-sitekey="6LetCTEqAAAAANROWtPzfC7Rfg9iIRiRt2k2FPn7"></div></div><input class="button button--full-width" type="submit" data-submit-text="Sending…" value="Send"></form><p class="modal__text">Forgot to connect your email to the profile? Email us and we’ll help.</p></div></div></div><script async src="https://assets.htmlacademy.org/js/general.v274.js" data-assets="https://assets.htmlacademy.org" data-require="toggle,navigation-courses,modal,form,nav"></script></body></html>