从按钮到TextArea Javascript的文本

时间:2015-10-12 12:31:22

标签: javascript textarea

所以我有一个设置textBox值的按钮。我的问题是我希望添加这个文本,而不是设置,所以我可以在已经写入的文本没有被删除时继续按下按钮。

contents: [
        {
            id: 'something',
            elements: [
                {
                    id: 'something2',
                    type: 'textarea', }



                 {   id: 'testbutton',
                    type: 'button',
                    button: 'button',
                    label: 'Button1',

                    onClick: function() {
                    this._.dialog.setValueOf("something","something2","Text was set ");
                    }

                },]

1 个答案:

答案 0 :(得分:0)

 onClick: function() {
                var curVal = this._.dialog.getValueOf( "something","something2" ) 
                this._.dialog.setValueOf("something","something2", curVal + "Text was set ");
                }

试试这个解决方案,我希望它会对你有所帮助!