Control.addStateClass

Syntax

addStateClass(value);

Parameters

value. Name of the CSS class.

Description

The addClass method adds a CSS class to the component and removes the previous CSS class.

Example

To execute the example, the HTML page must contain links to the PP.css, PP.js and jquery.js files. Add the TextArea component to the page, set offsets, new border type and fill color for this component:

     textArea = new PP.Ui.TextArea({
        ParentNode: document.body,
        Content: "Text"
     })
      textArea.addStateClass("newStyle")
      // Set styles for this class
      $("div.newStyle").css("margin", "20px");
      $("div.newStyle").css("border", "1px dashed");
      $("div.newStyle").css("background-color", "#FFF8DC")
      console.log("Background color: " + textArea.getCssStyle(textArea.getDomNode(), "background-color"));

After executing the example the page will contain the TextArea component that looks as follows:

Browser console will show background color in RGB format:

Background color: rgb(255, 248, 220)

See also:

Control