Clearing value before submitting form (not canceling submit)
<p>I want to clear my default value in two input fields before submitting them.
But this don’t work…</p>

<pre><code>&lt;form action="page.html" id="myForm"&gt;
    &lt;input type="text" value="Firstname" name="firstname" id="firstname"&gt;
    &lt;input type="text" value="Lastname" name="lastname" id="lastname"&gt;
    &lt;input type="submit"&gt;
&lt;/form&gt;

&lt;script&gt;
    $(document).ready(function() {
        $("myForm").submit(function() {
            if($('#firstname').val() == "Firstname")
                $('#firstname').val() = "";

            if($('#lastname').val() == "Lastname")
                $('#lastname').val() = "";

            return true;    
        });
    });
&lt;/script&gt;
</code></pre>

<p>I don’t want to clear them both on focus.
I cant use html5.</p>
