You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Forms - Thought the Class option for a field sets the class of the parent div. Does not appear to be the case today

posted on March 29, 2019 Show version history

I am trying to troubleshoot why I am unable to access any values with my javascript today. I thought when you set the class of a field in forms, it sets the class to the parent div, but the inspector shows no such thing.

This is what I have entered for the class name for a Single Line field.

In the inspector it shows the div has a class name of cf-field. This input itself has two class names, singleline and cf-medium

 

Edit: Ok I see it is in the parent's parent li. Is it always set to this?

0 0
replied on March 29, 2019 Show version history

It doesn't set the class of the immediate parent, it sets a class for the parent containing both the field and the label. In most cases, this is an li element (with the form-q class).

In your screenshot, I see the "myclass" class on that li parent, and the reason it is done this way is so that you can adjust all the contents, including the label, with custom classes.

0 0
replied on March 31, 2019

Ok that makes sense. So we can use more than just .className input. We could also say .className div or .className label

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.