Dear Team,
We have four fields in the box: one is of "Tooltip link" type, others are - "Text".
Is it possible to change colour (font size or any other text parameters) for one of the three text elements using JavaScript?
Example:
- Department (Tooltip link)
- Position (Text)
- Employee name (Text)
- Company (Text)
We would like to have position name in bold and red colour, other text fields - black text colour.
Regards,
Ilia
Hi @isychev ,
Yes, this is quite easy to set up with some additional CSS rules.
Note that my example below uses the Box template, but the
Tooltip template has the same exact syntax.
-
Please switch to the "HTML mode" of the tooltip template. Add any additional class to the property you need. For example, I add a custom class to the department field
-
No specify the CSS rule for the new class:
-
The "Department" field now has a different styling:
Hi @v.uspenskii,
Thank you! Can the requirement be achieved using only JavaScript (i.e. without switching to HTML mode in Box Template)?
Regards,
Ilia
@isychev ,
This is doable, though less easily than with HTML template.
You can use the following jQuery script to get to the necessary element:
renderer.onBoxRendered(function(event, box, itemData){
box.$elem.find('.pl-item-fields div:nth-child(3)').css({'color':'green'})
});
, where :nth-child() should hold the position of the element you want to change styling for (starting with 1).
For example, the code above produces the following result: