diff --git a/cocos2d/core/components/CCEditBox.js b/cocos2d/core/components/CCEditBox.js index 1e767d310a..94e510771c 100644 --- a/cocos2d/core/components/CCEditBox.js +++ b/cocos2d/core/components/CCEditBox.js @@ -44,14 +44,17 @@ var EditBox = cc.Class({ }, properties: { + _string: '', /** * Input string of EditBox. * @property {String} string */ string: { - default: '', - notify: function() { - this._sgNode.string = this.string; + get: function () { + return this._sgNode.string; + }, + set: function(value) { + this._sgNode.string = this._string = value; } }, @@ -226,7 +229,7 @@ var EditBox = cc.Class({ sgNode.inputMode = this.inputMode; sgNode.maxLength = this.maxLength; - sgNode.string = this.string; + sgNode.string = this._string; sgNode.fontSize = this.fontSize; sgNode.fontColor = this.fontColor; sgNode.placeHolder = this.placeHolder;