# Double quotes and temporal literals

**URL:** <https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [February 28, 2024, 3:14pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822 "2024-02-28T15:14:53Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![abigail.figaro](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abigail.figaro/32/371461_2.png) [@abigail.figaro](https://forum.freecodecamp.org/u/abigail.figaro)\
**Post date:** [February 28, 2024, 3:14pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/1 "2024-02-28T15:14:53Z")

</div>

1. Give your `label` element a `for` attribute with the value `X-#-name` , where `X` is the `value` of the `entryDropdown` element and `#` is the value of `entryNumber` . Remember that HTML attributes should be wrapped in double quotes.

CURRENT CODE:

```auto
function addEntry() {
  const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
  const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
  const HTMLString = `
  <label for="`#${entryDropdown.value}`-${entryNumber}-name">`Entry ${entryNumber} Name`</label>
}

```

---

<div class="post-metadata">

**Author:** ![llencses78](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/llencses78/32/184212_2.png) [@llencses78](https://forum.freecodecamp.org/u/llencses78)\
**Post date:** [February 28, 2024, 3:34pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/2 "2024-02-28T15:34:11Z")

</div>

Hello:(

You have to close your label element ( [: The Label element - HTML: HyperText Markup Language | MDN (mozilla.org)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label))  
:

```auto
<label for="username">Enter your username:</label>

```

---

<div class="post-metadata">

**Author:** ![llencses78](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/llencses78/32/184212_2.png) [@llencses78](https://forum.freecodecamp.org/u/llencses78)\
**Post date:** [February 28, 2024, 3:38pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/3 "2024-02-28T15:38:56Z")

</div>

And you are missing the first back tick from your template literal.  
[JavaScript Template Strings (w3schools.com)](https://www.w3schools.com/JS//js_string_templates.asp)

```auto
let text = `Hello World!`;

```

---

<div class="post-metadata">

**Author:** ![abigail.figaro](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abigail.figaro/32/371461_2.png) [@abigail.figaro](https://forum.freecodecamp.org/u/abigail.figaro)\
**Post date:** [February 28, 2024, 3:46pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/4 "2024-02-28T15:46:00Z")

</div>

```auto
  <label for = `${entryDropdown.value} - ${entryNumber} - name entry ${entryNumber} name`></label>

```

This doesn’t work either. It’s not even giving me the help option.

---

<div class="post-metadata">

**Author:** ![llencses78](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/llencses78/32/184212_2.png) [@llencses78](https://forum.freecodecamp.org/u/llencses78)\
**Post date:** [February 28, 2024, 3:50pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/5 "2024-02-28T15:50:44Z")

</div>

A **self closing tags** in HTML are the type of [HTML tags](https://www.tutorialstonight.com/html/html-tags) that need not to be closed manually by its closing tag, which means there is no saperate closing tag for it as .

```auto
<label for="html">HTML</label>

```

---

<div class="post-metadata">

**Author:** ![llencses78](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/llencses78/32/184212_2.png) [@llencses78](https://forum.freecodecamp.org/u/llencses78)\
**Post date:** [February 28, 2024, 3:54pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/6 "2024-02-28T15:54:48Z")

</div>

```auto
const HTMLString = `<label></label>`

```

---

<div class="post-metadata">

**Author:** ![abigail.figaro](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abigail.figaro/32/371461_2.png) [@abigail.figaro](https://forum.freecodecamp.org/u/abigail.figaro)\
**Post date:** [February 28, 2024, 4:01pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/7 "2024-02-28T16:01:49Z")

</div>

thank you, I didn’t realize this was an option.

---

<div class="post-metadata">

**Author:** ![abigail.figaro](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abigail.figaro/32/371461_2.png) [@abigail.figaro](https://forum.freecodecamp.org/u/abigail.figaro)\
**Post date:** [February 28, 2024, 4:04pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/8 "2024-02-28T16:04:03Z")

</div>

> [@llencses78](#):
>
> `HTMLString`

```auto
function addEntry() {
  const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
  const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
  const HTMLString = `<label for=${entryDropdown.value}-${entryNumber}-name></label>`
}

```

this still doesn’t work. I copied and pasted " Your `label` element should have a `for` attribute set to `${entryDropdown.value}-${entryNumber}-name` "

---

<div class="post-metadata">

**Author:** ![llencses78](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/llencses78/32/184212_2.png) [@llencses78](https://forum.freecodecamp.org/u/llencses78)\
**Post date:** [February 28, 2024, 4:31pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/9 "2024-02-28T16:31:51Z")

</div>

Can you tell me which step is this?

---

<div class="post-metadata">

**Author:** ![llencses78](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/llencses78/32/184212_2.png) [@llencses78](https://forum.freecodecamp.org/u/llencses78)\
**Post date:** [February 28, 2024, 4:35pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/10 "2024-02-28T16:35:09Z")

</div>

```auto
const HTMLString = `
  <label for="${entryDropdown.value}-${entryNumber}-name">Entry ${entryNumber} Name</label>`;

```

---

<div class="post-metadata">

**Author:** ![abigail.figaro](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abigail.figaro/32/371461_2.png) [@abigail.figaro](https://forum.freecodecamp.org/u/abigail.figaro)\
**Post date:** [February 28, 2024, 4:45pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/11 "2024-02-28T16:45:44Z")

</div>

> [@llencses78](#):
>
> `Entry ${entryNumber} Name`

my goodness. Thank you so much!

---

<div class="post-metadata">

**Author:** ![llencses78](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/llencses78/32/184212_2.png) [@llencses78](https://forum.freecodecamp.org/u/llencses78)\
**Post date:** [February 28, 2024, 4:52pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/12 "2024-02-28T16:52:55Z")

</div>

If you put your code between backticks, ``` (three each) before and after your code, then it is more readable:)

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [February 28, 2024, 8:57pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/13 "2024-02-28T20:57:42Z")

</div>

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](https://forum.freecodecamp.org/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (').

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [February 28, 2024, 8:59pm UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/14 "2024-02-28T20:59:07Z")

</div>

> [@abigail.figaro](#):
>
> ```auto
> "`#${entryDropdown.value}`-${entryNumber}-name">`
> 
> ```

don’t use the backticks here, remove them, you are already in a template literal, adding more backticks means you are ending the string early

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [August 29, 2024, 9:00am UTC](https://forum.freecodecamp.org/t/double-quotes-and-temporal-literals/675822/15 "2024-08-29T09:00:06Z")

</div>

Closed on August 29, 2024, 9:00am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
