Add Current Date/Month/Year in Unbounce form field

I got this question in the Unbounce community where one of the users was looking for the solution to dynamically update one of the fields in the form with the current month.

 

So If one user has this question then plenty of other users may have the same questions as well or they’ll find it useful, so it’s best to post it as a solution on the website and make a video on it.

 

So let’s see how we can dynamically add the current date, month and year in Unbounce form.

 

Please copy the script below.

 

Then watch the video above to see how you can add it.

 

				
					<script>
const month = ["January","February","March","April","May","June","July","August","September","October","November","December"];
const week = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
  
const d = new Date();
let name = month[d.getMonth()];
let day = week[d.getDay()];  
  
var year = d.getFullYear();

var date = d.getDate();  
  
  document.getElementById("month").value = name;
  document.getElementById("year").value = year;
  document.getElementById("date").value = date;  
  document.getElementById("day").value = day;
  document.getElementById("fulldate").value = d;



</script>
				
			

If you’re looking to sign up for Unbounce, then you can get 20% exclusive discount for the first 3 months and 14-Days FREE trial here.

Leave a Reply

Your email address will not be published. Required fields are marked *

Picture of Sahibjot Singh

Sahibjot Singh

Hey there! I'm Sahibjot Singh, and I've been on an exciting journey as a Web Designer/Developer and Email Automation expert for the past 12 years. It's been a fantastic ride filled with new challenges, and I've learned how to overcome various issues along the way.

One thing that's always been a part of my journey is the need to research and gather different puzzle pieces, using my coding knowledge to piece together solutions for a wide range of problems.

But here's the thing: I've realized that there are many business entrepreneurs and non-technical folks out there who don't have coding skills but often find themselves in similar situations.

So, what makes Unbouncehacks/Unbouncetips special? Well, it's not just a collection of scattered information. I've put together complete end-to-end solutions for the very problems I've encountered and that you might face in the future.

Plus, I keep this website updated with fresh tips and suggestions that have helped me excel in design and email marketing over the years. So, you're in for a treat with a treasure trove of knowledge! 🚀

Share:

Facebook
LinkedIn
Twitter
Skype
WhatsApp

Most Popular

Follow Us

Categories

Doing the best for email marketing? Still your domain can be black listed if you hit a spam trap, once.


Verify your contacts for FREE and make sure there are no spam traps or invalid emails. 

Read More

Related Posts

― Receive the latest articles
Subscribe To Our Newsletter

Get notified about new articles