< Back

Contents

Add CSS & JS

The easiest way to add some CSS and JS:

JS

String customJs = """
function saveEntry() {
	run("add.groovy", \$("#title").val(), \$("#text").val());
}
""";

HTML.js(customJs);

// Or:
System.out.println("<script>" + customJs + "</script>");

(please remember to use "$" instead of just "$" inside of Strings)

CSS

String customCss = """
.note {
	border: 2px solid #bbb; padding: 0.5em 1em; margin-top: 0.3em; width: 50%;
}
""";

HTML.css(customCss);

Html

More details on adding HTML: Script Output