Chapter projects
Email extractor
Use the following HTML as a starter template and add the JavaScript code to make an email extractor function:
<!doctype html>
<html>
<head>
<title>Complete JavaScript Course</title>
</head>
<body>
<textarea name="txtarea" rows=2 cols=50></textarea> <button>Get Emails</button>
<textarea name="txtarea2" rows=2 cols=50></textarea>
<script>
</script>
</body>
</html>
Take the following steps:
- In JavaScript, select both text areas and the button and set them as JavaScript objects.
- Add an event listener to the button that will invoke a function that gets the content of the first
textarea
and filters it to only accept email addresses. - Within the extracting function, get the content of the first input field. Using
match()
, return an array of the email addresses that were matched from...