-
Notifications
You must be signed in to change notification settings - Fork 2
JSL.addStyle()
joesimmons edited this page Sep 25, 2013
·
1 revision
Syntax: JSL.addStyle( contentString [, ID] [, parentNode] );
Parameters:
-
contentString: A string to be the content of the
<style>
element. -
ID: (optional) An ID to give the element; if omitted,
jsl-style-
plus a random number from 1 to 999 will be used. -
parentNode (optional) Append the created
<style>
element to this element, instead of<head>
Example:
JSL.addStyle('body { color: red; }');
The above code will add this to the <head>
element of the page:
<style>body { color: red; }</style>
Note: If you want to pass the parentNode parameter but still want a random ID, just pass a falsy value as the second argument.
Example: JSL.addStyle('body { color: red; }', 0, iframe.head);