开发者

Save all CodeMirrors on page

开发者 https://www.devze.com 2023-04-05 12:50 出处:网络
How I can save() all CodeMirror开发者_StackOverflow社区 textareas on one page?You\'d have to cache all CodeMirror instances in to an array, and then loop through that array save()\'ing each instance.

How I can save() all CodeMirror开发者_StackOverflow社区 textareas on one page?


You'd have to cache all CodeMirror instances in to an array, and then loop through that array save()'ing each instance.

var CMInstances = [instance1, instance2, ..., instanceN];
for (instance in CMInstances) {
  instance.save();
}

I'd assume at some point in your script you're setting up your CodeMirror instances, so that point would be ideal to cache them.

0

精彩评论

暂无评论...
验证码 换一张
取 消