Pro JavaScript Development by Den Odell

Pro JavaScript Development by Den Odell

Author:Den Odell
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


Figure 9-1.The final page we’re building represents a newsletter sign-up form, which will only submit if the e-mail address provided is in a valid format

Before we write any JavaScript code, we’ll download a copy of RequireJS from the project homepage at http://bit.ly/require_dl . At the time of writing, the current version of this library is 2.1.9, and it’s supported in all the major web browsers all the way back to Internet Explorer 6, Firefox 2, Safari 3.2, Chrome 3, and Opera 10.

Now, before we add RequireJS to our page, we need to review which JavaScript files we’re going to need for our application and organize them into an appropriate folder structure. We’ll start with our main application script file, which, using jQuery, will listen for the submit event on the HTML form and perform form validation when this occurs, only allowing the form to continue submitting if there are no errors. We will therefore have three JavaScript files in addition to the RequireJS library, as shown in Table 9-1.

Table 9-1.The three JavaScript files used in our project, in addition to RequireJS



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.