setAttribute()

Sets an attribute for an element.

Syntax

behavior.setAttribute(element, attributeName, value);

Example

var mybehavior = jsb.behavior.extend({
  onclick: function(element) {
    this.setAttribute(element, "active", "true");
  }
});

Notes

This method provides a cross-browser, safe way to perform the W3C equivalent method. Most of the time you can use the W3C method. If you are not sure then use the jsb method.

See Also