2015-10-12 35 views
0

所以我有一個按鈕,它設置了一個文本框的值。我的問題是我想要添加這個文本,而不是設置,所以我可以繼續按下按鈕,而已經寫入的文本不會被刪除。從文本按鈕到TextArea Javascript

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 "); 
        } 

       },] 
+0

'This ._。dialog.setValueOf'嘗試'._。dialog.addValueOf' – Anonymous0day

+0

@ Anonymous0day不,它不起作用! – Kostakiiiis

+0

看到我的答案! – Anonymous0day

回答

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

嘗試這種解決方案,我希望它會幫助你!

+0

這工作正常......現在我想起來,這是非常合乎邏輯的。謝謝 ! – Kostakiiiis