Manipulating data

We are going to add one more input to our form, which will be for the user's description. In the description, we will parse for things, such as e-mails, and then create both a plain text and HTML version of the user's description.

The HTML for this form is pretty straightforward; we will be using a standard textbox and give it an appropriate field:

Description: <br />
<textarea id="description_field"></textarea><br />

Next, let's start with the bare scaffold needed to begin processing the form data:

function process_description() { var field = document.getElementById("description_field"); var description = field.value; data.text_description = description; // More Processing Here data.html_description = "<p>" + description + "</p>"; ...

Get JavaScript Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.