Novice RoR programmer here, I've run into a bit of a stumbling block,
concerning Time.now seemingly not updating in between JS function
calls.

My code is as follows:

function test()
{
document.getElementById("chatbox").value += "<%= Time.now %>" + "\n";
}

...

<textarea id="chatbox" rows="10" cols="80" class="chatbox"
readonly="true" onclick="test();">
</textarea>

Basically, clicking the textarea "chatbox" will add a line with the
current time, and unfortunately, every click on the textarea results
in the identical line being written, which is the time that the page
was loaded.

Is there any way I could get Time.now to update with every click?

Thanks in advance!

Nick.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to