Tahi Reu
Tahi Reu

Reputation: 590

Gravity Forms - Add different CSS classes to First and Last Name fields

In the Gravity Forms, First and Last name fields are actually inside the "Name" field.

I can add a CSS class to the Name field, but I cannot add different CSS classes to each First and Last name fields.

Is this possible? Is there a filter hook or something that I missed?

Upvotes: 0

Views: 247

Answers (1)

Rochelle
Rochelle

Reputation: 633

You can add an HTML field at the top of your form with the following script:

<script type="text/javascript">
jQuery(document).ready(function(){
   jQuery("#input_60_58_3").addClass("milk");//replace '60' with your form id, replace "58" with the name field id, leave the 3 as that is needed to isolate the first name
   jQuery("#input_60_58_6").addClass("cookies");//replace '60' with your form id, replace "58" with the name field id, leave the 6 as that is needed to isolate the last name
});
</script>

Upvotes: 0

Related Questions