The following example shows how you can create a simple custom component in ColdFusion.
In a previous example, “Creating alternating row colors on a table in ColdFusion”, we saw how you could add alternating row colors on an HTML table in ColdFusion by looping over a database query and using the query
currentRow attribute and the
MOD operator to determine if the current row number is “odd” or “even”.
The following example shows how you can use jQuery to dynamically set the CSS
backgroundColor style if the current table row is “odd” or “even”.