How to change a colour of a particular field?

  • wkwan
    Asked on July 24, 2021 at 4:02 AM

    How do I change the font color of one or more fields without changing the rest of the fields?

  • igorbojczuk
    Replied on July 24, 2021 at 11:40 AM

    Hi,

    You would have to find the unique ID of the fields which colour you would like to change. For example, I injected the following custom CSS code to change this label:

    #label_28 {
    color: blue!important;
    }

    1627140936 60fc334808006  Screenshot 10

    And this code to change the colour of the input below:

    #input_14 {
    color: red!important;
    }

    1627141038 60fc33ae556d7  Screenshot 21


    Please refer to this guide for more information about finding Fields IDs on your own, and this guide about injecting custom CSS.

    Should you need any more help with that, please let us know.

    Regards,

  • wkwan
    Replied on July 24, 2021 at 2:56 PM

    I am having trouble finding the label number for the single choice element that I want to change the question color. The single choice element is toward the end of this form https://www.jotform.com/build/212039121687049 I want to make the circled text red.

    1627152943 60fc622f3812e  Screenshot 10

    It may also be that I didn't get the custom CSS code correct? In either case, I appreciate the help.


  • igorbojczuk
    Replied on July 24, 2021 at 5:35 PM

    Hi,
    Please add this code to your form:

    #label_66 {
    color: red!important;
    }


    Regards,

  • wkwan
    Replied on July 24, 2021 at 5:37 PM

    Perfect! Now how do I modify the code if I want to use the hex code for color so it's still red but not the bright red?

    Still on this form, what is the CSS code to change the background of widgets? See below where the four white color field do not match the gray one. Thanks!

    1627163863 60fc8cd7dff71  Screenshot 10

  • igorbojczuk
    Replied on July 24, 2021 at 7:07 PM

    Hi,

    You can just change red to your HEX code, or even rgba:

    #label_66 {
    color: HEX_CODE!important;
    }


    Regarding the widgets, would you like to change the other inputs to grey, or the grey one to white?

    Regards,

  • wkwan
    Replied on July 24, 2021 at 7:11 PM

    The other inputs to grey (or some other color in the future). Thank you again!

    Another color issue came up, see below where I am using the Infinite List widget and the text in the circle is hard to see against the background:

    1627169247 60fca1df7b981  Screenshot 10

    Can the color of that text be changed?

  • igorbojczuk
    Replied on July 24, 2021 at 7:28 PM

    Hi,
    Please add this code to your widget settings:
    1627169300 60fca21493e66  Screenshot 10

    #maskedInput {
     background: #838895!important;
     box-shadow: none;
     border:none;
    }
  • wkwan
    Replied on July 24, 2021 at 7:31 PM

    That works. In case my last edit didn't come up, please see below.

    Another color issue came up, see below where I am using the Infinite List widget and the text in the circle is hard to see against the background:

    1627169247 60fca1df7b981  Screenshot 10

    Can the color of that text be changed?

  • igorbojczuk
    Replied on July 24, 2021 at 7:36 PM

    Hi,

    I can see you have already fixed this issue.

    Is it working as you would like it to? Or is there something else you'd like changed?

    1627169767 60fca3e785c43  Screenshot 10

    Regards,

  • wkwan
    Replied on July 24, 2021 at 7:40 PM

    No, that issue is not fixed. The text that I circled shows up when you are actually using the form, not in the builder. You can see it after enter some text in the boxes and hit save when using Preview Form.

    I also tested the CSS code to change color on two other widgets (Dynamic Dropdowns and Infinite List) but they don't work on them. Why is that?

    1627169909 60fca475a1ff4  Screenshot 101627169946 60fca49ab987c  Screenshot 21

  • igorbojczuk
    Replied on July 24, 2021 at 7:52 PM

    Hi,

    Could you please send us a screenshot? This is what we are seeing in the preview:
    1627170501 60fca6c565089  Screenshot 10

    Regarding the other issue.
    Instead of #DynamicDropdown please use #select2-twsw-container, and instead of #infiniteList please use #listContainer.

    Regards,

  • wkwan
    Replied on July 24, 2021 at 8:25 PM

    Changing #DynamicDropdown to #select2-twsw-container had no effect. Changing #infiniteList to #listContainer changed the background of the field but not the inside.

    1627172665 60fcaf39ead73  Screenshot 10

    The top one uses #listContainer, the bottom uses #infiniteList.

    The above also shows the other issue. You have to hit the save button for the additional text to show up.

  • igorbojczuk
    Replied on July 24, 2021 at 8:41 PM

    Hi,
    It seems like id of the Dynamic Dropdown is generated every time the page is refreshed, so we need to use its class (which is constant) .select2-selection__rendered (please remember about the dot).

    Regarding the other fields, please try this code:

    #listContainer input[type="text"] {
    background#838895!important;
     box-shadow: none;
     border:none;
    }


    Regards,

  • wkwan
    Replied on July 24, 2021 at 8:47 PM

    The first one is still not working even with the CSS code like this:

    1627174012 60fcb47cd5796  Screenshot 10

    The second works, thank you. But there is still the matter of changing the color of the text that I've circled so it stands out better from the background gray:

    1627173947 60fcb43b9de91  Screenshot 21

    Thank you so much for your time, Igor!

  • Amin JotForm Support
    Replied on July 25, 2021 at 4:24 AM

    Hi again,

    Please remove the first "#" before the "." in the CSS code provided my colleague.

    As per the color issue, kindly inject the following CSS code into the two widgets:

    .col1, .col2{
    color: white !important
    }


    Result in a demo form:

    https://form.jotform.com/212051983673963

    I hope I have been of any help.

  • wkwan
    Replied on July 25, 2021 at 1:22 PM

    Much thanks, Amin, and to Igor as well!