Stuck calling a onclick function
<p>I have been banging my head on this for a while now...</p>

<pre><code>medReviewCtrl = "&lt;form name=\"medsreviewedform\"&gt; \
    &lt;input type=\"button\" class=\"medsreviewedclass\" name=\"medsreviewedname\" \
    id=\"medsreviewedid\" value=\"7 minutes ago\" onclick=\"ChangeButtonText(this)\" \
    &lt;/form&gt;";

function ChangeButtonText(button){
    document.getElementById("medsreviewedid").value="Value has changed";
}​
</code></pre>

<p>I have a js file where I create a dynammic div of which this button is part of it. The button displays fine and but when I try to call this function I get Object Expected. If I do it like this it works;</p>

<pre><code>onclick=\"this.value=this.value==this.defaultValue?'Less than a minute ago':this.defaultValue;\" /&gt;";
</code></pre>

<p>Ultimately the objective the default value will be derived from a time value (1 week ago) and onclick will write to a value to the database and the buttons value will be something like less than a minute ago. I have everything else but I just cannot figure out how to change the value.</p>

<p>I have tried the code is jsFiddle and it works there but not in my example. <a href="http://jsfiddle.net/hPQP9/61/" rel="nofollow">http://jsfiddle.net/hPQP9/61/</a></p>

<p>Any help appreciated!</p>
