Practice
JavaScriptData StructuresReactConcepts
Sign in
← Back to problems

Set an Input Value

DOM & Eventseasy

Course · Section 7: JavaScript in the Browser: DOM and Events · Lecture 76: Selecting and Manipulating Elements

The page has an empty `<input id='name'>`. Set its value to `Ada`.

Sample tests

Input: the input value is 'Ada'
Output: assertion passes

+ 1 hidden test run on Submit.

Hints

Common pitfalls
  • Setting the value attribute differs from the live value property in some cases.

Learning resources

  • MDN: HTMLElement.dataset
Approach & explanation (try first)

Assigning to input.value updates the field's current value.

Loading...
⌘/Ctrl + Enter

Run your code to see results.