__defineSetter__ Redirect 1

This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

This feature has been removed from the Web. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.


The __defineSetter__ method binds an object's property to a function to be called when an attempt is made to set that property.


obj.__defineSetter__(sprop, fun)


A string containing the name of the property to be bound to the given function
A function to be called when there is an attempt to set the specified property. This function takes the form
function (val) { . . . }
an alias for the variable that holds the value attempted to be assigned to prop


The __defineSetter__ method allows a setter to be defined on a pre-existing object.


Not part of any specifications.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) IE 11 (Yes) (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) ? (Yes) (Yes)

See also

Document Tags and Contributors

 Last updated by: Sheppy,