# Pass field data to javascript CSS

**URL:** <https://forums.knack.com/t/pass-field-data-to-javascript-css/8316>\
**Category:** Ask Developers\
**Created:** [October 30, 2020, 5:40pm UTC](https://forums.knack.com/t/pass-field-data-to-javascript-css/8316 "2020-10-30T17:40:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeanBozzan62116](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DeanBozzan62116](https://forums.knack.com/u/DeanBozzan62116)\
**Post date:** [October 30, 2020, 5:40pm UTC](https://forums.knack.com/t/pass-field-data-to-javascript-css/8316/1 "2020-10-30T17:40:05Z")

</div>

I have an Object and related Details View that has a short text field that contains a hex color code (#ff0000).&nbsp; I am trying to pass that value in a Scene over to a CSS override to change the font colors on the page. When I hard code the color in javascript it works but when I create a variable to read the field value I am not getting anything. I have a multi-tenant app and I want the Organizations to choose their own color codes to match their logos. This code works:  
  
$(document).on('knack-scene-render.scene\_305', function(event, scene) {  
var current\_Color = "#ff0000";  
$('h3').css('color', ''+current\_Color+'','!important');  
});  
  
I need to change   
var current\_Color = "#ff0000";  
to&nbsp;  
var current\_Color = "FieldTextValue";

The FieldTextValue is a hex code like #ff0000 - short text field in the object  
  
Tried a few things, this one seems to be populating the H3 but with empty data:  
var current\_Color = $('#view\_2401.field\_3133 .kn-value').text();

---

<div class="post-metadata">

**Author:** ![ZapBaum60976](https://avatars.discourse-cdn.com/v4/letter/z/8dc957/32.png) [@ZapBaum60976](https://forums.knack.com/u/ZapBaum60976)\
**Post date:** [October 31, 2020, 12:53pm UTC](https://forums.knack.com/t/pass-field-data-to-javascript-css/8316/2 "2020-10-31T12:53:58Z")

</div>

Thanks Dean - this helps me

---

<div class="post-metadata">

**Author:** ![DeanBozzan62116](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DeanBozzan62116](https://forums.knack.com/u/DeanBozzan62116)\
**Post date:** [October 30, 2020, 6:05pm UTC](https://forums.knack.com/t/pass-field-data-to-javascript-css/8316/3 "2020-10-30T18:05:07Z")

</div>

Nevermind for anyone trying to do this I found the right code:  
  
var current\_Color = Knack.models['view\_2401'].toJSON().field\_3133;
