About Pi Downloads Documentation Plugins Developer Forum Issues

pi.element.environment.addStyle

Summary

Applies css values from given hash to specified element.(Fixes opacity values and cssFloat/styleFloat property for IE)

Syntax

element.environment.addStyle({ CSSProperty:'CSSValue' });

Example 1

>>> MyForm.environment.getView("backgroundColor");
"green"
>>> MyForm.environment.addStyle({ "backgroundColor":"red" });
>>> MyForm.environment.getView("backgroundColor");
"red"

Example 2

new pi.element("div").environment.addStyle({
	"border":"3px solid red", "backgroundColor":"black", "color":"white", "fontFamily":"Arial, sans-serif"
}).update("Hello World")
The above example will output:
<div style="border:3px solid red; background-color:black; color:white; font-family:Arial, sans-serif;">
	Hello World
</div>

See Also