$style.set
Set the element`s CSS property.
$style( element, propertyName, value )
element [object]
The target element will be set.propertyName [string]
The CSS property name.value [string]
The CSS property value.
Notes
This function is directly set the CSS style for element via native code for highest performance. To increase the performance, the property name should have to self-camelCased. If cannot sure the property name and property value is correct, use the $css.set() function.
Example
HTML code
<div id="box">This is a box</div> <button onclick="start_set_style()">set style</button>
CSS code
#box {
width: 200px;
height: 60px;
font-size: 12px;
background: #5599bb;
padding: 10px;
}JavaScript code
function start_set_style()
{
var box = $("box");
$style.set( box, "width", "400px" );
$style.set( box, "height", "120px" );
$style.set( box, "background", "#ccc" );
}
Demonstration
This is a box