Example: Using text input
In this example we make use of the fact that the text typed in as text input can be accessed as the value
attributeExtra information added to an element. of that element. Try typing in the name of a colour.
Notice the use of this
to change the colour of the button to which the event listener has been added.
Note:
Hints:
- undefined
1
2
window.onload = startFunction;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX