How to Add class to the Input Field TextBox

How to Add class to the Input Field TextBox

srimansri6srimansri6 Posts: 4Questions: 2Answers: 0

Hi,

Can you help me to know how we can add a class name just to the Editor Field Textbox.

I tried this below, but it adds the class name to the whole input element, i need the class name assigned only to the Text box.

fields: [
{
"label": "Site Group",
"name": "SITE_GROUP",
"className": "manclass"
}
]

Any help on this would be much appreciated.

Replies

  • allanallan Posts: 63,785Questions: 1Answers: 10,511 Site admin

    You could use attr option of the text input type - for example:

    {
      "label": "Site Group",
      "name": "SITE_GROUP",
      "attr": {
        "class": "manclass"
      }
    }
    

    Another option is to use the field().input() method:

    editor.field( 'myFieldName' ).input().addClass( 'myClass' );
    

    Allan

This discussion has been closed.