Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
68
rated 0 times [  73] [ 5]  / answers: 1 / hits: 18536  / 13 Years ago, sat, march 19, 2011, 12:00:00

How do I use the refresh function from CodeMirror 2?



refresh()




If your code does something to change
the size of the editor element (window
resizes are already listened for), or
unhides it, you should probably follow
up by calling this method to ensure
CodeMirror is still looking as
intended.




I want to refresh all textareas after a link is clicked



I tried



  $('.CodeMirror').each(function(){
getElementById($(this).attr('id')).refresh();
});


but it doesn't work....


More From » jquery

 Answers
11

The refresh method (just like all other CodeMirror methods) does not live on the DOM node, but on the instance object that's returned when you create the editor (by calling CodeMirror or CodeMirror.fromTextArea). So you'll have to store those somewhere for this to work.


[#93181] Friday, March 18, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alli

Total Points: 409
Total Questions: 101
Total Answers: 105

Location: The Bahamas
Member since Tue, Apr 27, 2021
3 Years ago
alli questions
Sat, Apr 23, 22, 00:00, 2 Years ago
Mon, May 18, 20, 00:00, 4 Years ago
Tue, Mar 24, 20, 00:00, 4 Years ago
Fri, Jan 24, 20, 00:00, 4 Years ago
;