How could I improve this code so that I didn't need to place all code inside initAll()?
I have some form handling stuff, and I want to refactor that to OOP. This is the first thing I need to be more sure about.
Code:/* Handling forms with object oriented programming. */ /* Wait for the DOM the be ready. */ window.onload = initAll; function initAll() { var FormValidator = { // {{{ msg: document.forms['contact'].msg, }; // }}} //console.log(FormValidator.msg); /* Inserts 'value' into the textarea. */ FormValidator.msg.value = 'Hello world, from JavaScript!'; } /* vim:set foldmethod=marker foldmarker={{{,}}}: */


Reply With Quote

Bookmarks