Include javascript via css?

css, javascript, styles

Solution

No, this is not possible, and nor should it be. Separate your application logic from your styling.

For when the two need to interact, you can detect certain styles with JavaScript and load various other JavaScript files from there.

Problem

Well basically I have a website with styles contained within various css files, now I'd like to add a certain js, but only in one style. So I would like to be able to add it in my css file, is such thing possible?

Original source

Related problems