week 4 (code journal) Flashcards

1
Q

in js forms, what is the name attribute in tags for?

e.g. name=”title”

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how do you use the “required” attribute for forms?

A

just type required. no value is needed.

e.g.

<textarea>
</textarea>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what does this do:

$newObj.title = document.forms[0].elements.title.value;

And what does the [0] here do instead of “title”?
$newObj.title = document.forms[0].elements[0].value;

A

the value of the element with the name “title” among elements within the first form (index 0) on the document is is being set as the title variable within the $newObj.

they both do the same thing except the second is searching by index instead of the “name” attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what does this do:

$newObj.title = document.forms[0].elements.title.value;

And what does the [0] here do instead of “title”?
$newObj.title = document.forms[0].elements[0].value;

A

the value of the element with the name “title” among elements within the first form (index 0) on the document is is being set as the title variable within the $newObj.

they both do the same thing except the second is searching by index instead of the “name” attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what does this do?

localStorage.getItem(‘javascript-local-storage’);

A

it goes into local storage in the browser and gets the value stored in local storage, and in this case the keyName is ‘javascript-local-storage’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly