Addon markText

Hi,

I create a marker with the command:

editor2.markText({line: tab2[click24] , ch: tab2[click24+1]}, {line: tab2[click24+2], ch: tab2[click24+3]}, {className:“aaaa”});

and I want to erase it to recreate another marker.

I test : editor2.clear(); editor2.markText.clear(); but it’s no good…

You have to save the return value from the markText call, and call .clear() on that.

let myMarker = editor.markText(....)
myMarker.clear()

I tested this without success :

Blockquote
function modepasapas2(){
var myMarker;
p=click2-1;
myMarker=editor2.markText({line: tab2[click24] , ch: tab2[click24+1]}, {line: tab2[click24+2], ch: tab2[click24+3]}, {className:“aaaa”});
if(p==1){myMarker.clear();}
/alert(tab2[click24]+","+tab2[click24+1]+","+ tab2[click24+2]+","+ tab2[click24+3]);/
click2++;

Summary

This text will be hidden

That code does the clearing immediately after creating the marker, which suggests that you’re having some trouble with more basic concepts such as control flow. My book (free online) might help with these basics.