# Updating a variable in a partial using Javascript?

**URL:** <https://www.ruby-forum.com/t/updating-a-variable-in-a-partial-using-javascript/183438>\
**Category:** Rails\
**Created:** [February 14, 2010, 6:57am UTC](https://www.ruby-forum.com/t/updating-a-variable-in-a-partial-using-javascript/183438 "2010-02-14T06:57:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlwaysCharging](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@AlwaysCharging](https://www.ruby-forum.com/u/AlwaysCharging)\
**Post date:** [February 14, 2010, 6:57am UTC](https://www.ruby-forum.com/t/updating-a-variable-in-a-partial-using-javascript/183438/1 "2010-02-14T06:57:12Z")

</div>

Currently in a partial, I have the following:

\<% @blogs.each do |blog| %\>  
\<% fields\_for “#{Time.now.to\_i}”, blog do |f| %\>

How do I update the #{Time.now.to\_i} every time the user clicks?

Currently, the Time only gets set whenever the page is loaded, is  
there a way to replace this using javascript?  
I’ve poured through Nest Form railscasts, as it solves a similar  
problem, but I can’t seem to adapt it to my needs.  
Honestly, I don’t even need to use Time, just a variable that  
increments so that the form’s id’s are different and Time just seemed  
like a logical choice.

Any help on this is greatly appreciated.
