# \[newbie\] Trouble adding script to dynamically change CSS values based on conditions

**URL:** <https://meta.discourse.org/t/newbie-trouble-adding-script-to-dynamically-change-css-values-based-on-conditions/51386>\
**Category:** Product Support\
**Created:** [11 Octubre, 2016 07:48 UTC](https://meta.discourse.org/t/newbie-trouble-adding-script-to-dynamically-change-css-values-based-on-conditions/51386 "2016-10-11T07:48:35Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)\
**Post date:** [11 Octubre, 2016 18:13 UTC](https://meta.discourse.org/t/newbie-trouble-adding-script-to-dynamically-change-css-values-based-on-conditions/51386/4 "2016-10-11T18:13:11Z")

</div>

Alright, I placed the code that @cpradio suggested in a CSS/HTML Customization page under the ![](https://global.discourse-cdn.com/meta/original/3X/e/9/e959f60ab9433179b610fb81a4fd8d34795236aa.png) tab, but unfortunately it doesn’t seem to be working. Just to prove the concept, I have it try to display an alert. Below is the exact code I am using:

```
<script type="text/discourse-plugin">

import { withPluginApi } from 'discourse/lib/plugin-api';

function initializePlugin(api)
{
  api.onPageChange((url, title) => {
        alert('test');
  });
}

export default {
  name: 'align-category-text',
  initialize: function(container)
  {
    withPluginApi('0.1', api => initializePlugin(api));
  }
};

</script>

```

I made sure the code was enabled and tried restarting rails. Any thoughts on what I’m missing?

---

_[View the full topic](https://meta.discourse.org/t/newbie-trouble-adding-script-to-dynamically-change-css-values-based-on-conditions/51386)._
