When I edit the code in a TextArea using CodeMirror how to reflect this into another textarea with js or jQuery

前端 未结 6 1075
暗喜
暗喜 2021-02-03 23:59

The App: I have a textarea element in my page. It is transformed using CodeMirror, because I need to indent and highlight html code withing it. Pic is in the li

6条回答
  •  滥情空心
    2021-02-04 00:42

    Last released version at moment (v 3.15) works with this solution:

    // on and off handler like in jQuery
    CodemirrorInstance.on('change',function(cMirror){
      // get value right from instance
      yourTextarea.value = cMirror.getValue();
    });
    

提交回复
热议问题