A JS library to embed simple JS snippets in CSS files.
The easiest way to get started is by adding the script tag in your document head, like so:
<script src="https://adir-sl.github.io/JSinCSS/jsincss.js"></script>After that, you can add to your CSS declaration a new content property that can hold any JavaScript you'd like to run, for example:
button:active {
content: "alert('Works!');";
}Everything decalred in CSS will run in its appropriate state, meaning content inside button will run when the button is loaded and unless told otherwise will only run once.
When declaring content inside button:active it will run when the button is clicked and, unless told otherwise, it will run everytime the user clicks that button.
The kind of quotation marks matters! Don't write it backwards or it might break. First the " " marks and only than the ' ' marks, NOT the other way around.