Solved

Can't apply color to certain fields using JS

  • 21 July 2017
  • 3 replies
  • 27 views

Badge +4

I have a date picker, single line text, drop down menu, people picker fields on my form.

When I click on a button it calls a method to highlight the border.

However it only works on the single line text and date picker fields.  

It is not working on the drop down and people picker fields. 

Ex: Department Name, Number, Submitted on Behalf Of

205820_pastedImage_1.png

Code

205821_pastedImage_2.png

Can anyone else replicate this issue?  

icon

Best answer by apham 26 July 2017, 15:22

View original

3 replies

Badge +9

Hi,

NWF$(document).ready(function()
{  
 NWF$('#'+text).css("cssText", "border-color: red");
NWF$('#'+date).css("cssText", "border-color: red");
NWF$('#'+dropdown).css("cssText", "border-color: red !important;");
NWF$('#'+people).closest('.nf-filler-control-border')[0].style.border='1px solid red'
});

Thanks,

Lakshmi

Badge +4

@Lakshmi C Thank you.  Your tip was very helpful.  However when applied the code to the drop down menu, it applied the CSS to a hidden text box below the drop down menu instead of the drop down menu itself.  Do you know why I am not getting the same results as you?

Badge +4

I did some research and used the parentsUntil() method to apply the CSS to all ancestor elements on the drop down menu.  Afterwards, the CSS was applied to only the drop down menu and the text box was removed.

Reply