Change background-color textentry field in a form | XM Community
Skip to main content
Hello,



In a survey I build in a form like the below screenshot:

!



On the field Zipcode I added a validation on Postalcode. If a wrong code is given, a message appears. But I also want to have a different background-color. How can I set this background-color to a bit of red?



Thanks in advance.
Do you want to set it permanently red or become red only on wrong entry.
@Nico_Leussink ;



jQuery("[id='QR~"+this.questionId+"~4'] ").css({"background-color":"red"});
@bansalpeeyush29 : I would like to have it red when wrong and default color when correct. Is such possible?
Default you can set as per @LaT while on error it seems difficult.
You can have look at below code



https://www.oreilly.com/library/view/javascript-cookbook/9781449390211/ch14s04.html
Thank you all, this helped me a lot.

Leave a Reply