This topic has 5 replies, 2 voices, and was last updated 3 years, 1 months ago ago by ianbarker24
Hi
I can see that the label class for a required field is class=”required-item”, but what is the class for an optional field please? I tried class=”optional-item” but that didn’t work.
Many thanks
Ian Barker
Hello,
If the field is optional it does not have a special class. But you can add any custom class for any field you use using class attribute, check here for example https://contactform7.com/text-fields/
Regards
Hi Olga,
The problem I have is that I removed the class statement for an attachment field in the contact form however it is still showing an asterix at the end of the title even though the field is not required, i.e. the form will submit with or without an attachment.
So, I’m trying to remove the asterix at the end of the title of the attachment field.
The form entry I have is,
[file your-attachment filetypes:gif|png|jpg limit:2mb]
Hello,
Because you added custom code to show it for all the labels https://prnt.sc/1uvc27c
Change it to
.wpcf7-form label.required-item:after {
content: "*";
color: #E95D2A;
}
Regards
Fantastic, many thanks Olga
All good now.
Cheers
Ian
The issue related to '‘Class for Contact Form 7 Optional field label’' has been successfully resolved, and the topic is now closed for further responses