Jump to content

Forms - Changing the label of a text field on a selection

Recommended Posts

Hi everyone,

We're trying to change the label of a text field on a dropdown selection. Based on the same site (pw: "new-website"), what we're tryign to do is:

1. When the Dropdown is "One", Change the label "Message" to "Message One"

2. When the Dropdown is "Two", Change the label "Message" to "Message Two"

I've devised the following code, which when inputting into the console, does manage to change the field, but when placed within the custom footer it doesn't work.

<script>  
  messageobject = document.getElementById("textarea-yui_3_17_2_1_1707503296891_717");
  messagelabel = messageobject.getElementsByTagName("span")[0];
  messagelabel.innerHTML = "TESTTESTTEST";
</script>

Any help would be appreciated!

 

Link to comment
  • Replies 0
  • Views 996
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.