User Error Messages | HTML data vs JavaScript
<p>I have this object below:</p>

<p>I thought about putting the messages in html like this</p>

<pre><code>&lt;div id = "text_identifier"&gt;text_here&lt;/div&gt; // div is hidden.
</code></pre>

<p>and then using getElementById to pull the message into JavaScript and finally display to the user in the correct element ( the parameter element in <code>Message</code> )</p>

<p>Two related questions?</p>

<p>Is it bad practice to have content in JavaScript like this?</p>

<p>If I do move the messages into the HTML, is the method I described above best practice?</p>

<pre><code>/**
 *Message
 */

var Message = function( element )
{
    var messages =  
    {
        name:         'Please enter a valid name',
        email:        'Please enter a valid email',
        pass:         'Please enter passoword, 6-40 characters',
        url:          'Please enter a valid url',
        title:        'Please enter a valid title',
        tweet:        'Please enter a valid tweet',
        empty:        'Please complete all fields',
        email_s:      'Please enter a valid email.',
        same:         'Please make emails equal',
        taken:        'Sorry, that email is taken',
        validate:     'Please contact &lt;a class="d" href="mailto:guy@host.com"&gt;support&lt;/a&gt; to reset your password',
    }
    this.display = function( type ) 
    {
        element.innerHTML = messages[ type ];
        new Effects().fade( element, 'down', 4000 );
    }
};
</code></pre>
