SetClass on Click

SetStyle lets you set a CSS style class for an element or elements. In this example, clicking on the avatar sets the style class name to 'dragged-over' which defines the following attribute: 'border:3px solid blue;'. For convenience you can either set the styleClass attribute or the addClass attribute. Both do the same thing.

You can click here to restart the example.

$proto('#avatar', {
  Click: {
    onClick: {
      SetClass: {
        styleClass: 'dragged-over',
      }
    }  
  }
});