let div document createElement div document body appendChild div div style border 1px solid blue div style width 20pt div style height 50pt div onmouseenter function console log entered div div onmouseleave function console log left div let div document createElement div document body appendChild div div style border 1px solid blue div style left 200pt div style width 10px div style height 200pt div style position relative div style box sizing border box let div2 document createElement div div appendChild div2 div2 style border 1px solid green div2 style width 50px div2 style height 50px div2 style position absolute div2 style display none div2 style pointer events none div2 style box sizing border box div2 style margin left 0px div2 style padding 10px div2 innerHTML button button button button button button let mp x 0 y 0 div onmouseenter function div2 style left 0px div2 style top mp y 10 px div2 style display inline div2 onmouseleave function div2 style display none document onmousemove function e mp x e pageX mp y e pageY var div document createElement div document body appendChild div div style border 1px solid blue div style left 200pt div style width 10px div style height 200pt div style position relative div style box sizing border box var div2 document createElement div div appendChild div2 div2 style border 1px solid green div2 style position absolute div2 style display none div2 style pointer events none div2 style box sizing border box div2 style margin left 0px div2 style padding 10px div2 innerHTML button onclick addcomment button let mp x 0 y 0 div onmouseenter function div2 style left 0px div2 style top mp y 10 px div2 style display inline div2 onmouseleave function div2 style display none document onmousemove function e mp x e pageX mp y e pageY window addcomment function console log add comment box console log mp div2 style display none var div3 document createElement div div appendChild div3 div3 style border 1px solid green div3 style position absolute div2 style pointer events none div3 style box sizing border box div3 style left 0px div3 style top mp y 10 px div3 style margin left 10px div3 style padding 5px div3 style border radius 5px div3 style display inline div3 innerHTML comment box div3 contentEditable true div3 onmouseenter function div2 style display none end addcomment let text a cat called test cat let safeText text replace a zA Z n g console log text console log safeText
n relative div style box sizing border box var div2 document createElement div div appendChild div2 div2 style border 1px solid green div2 style position absolute div2 style display none div2 style pointer events none div2 style box sizing border box div2 style margin left 0px div2 style padding 10px div2 innerHTML button onclick addcomment button let mp x 0 y 0 div onmouseenter function div2 style left 0px div2 style top mp y 10 px div2 style display inline div2 onmouseleave function div2 style display none document onmousemove function e mp x e pageX mp y e pageY window addcomment function console log add comment box console log mp div2 style display none var div3 document createElement div div appendChild div3 div3 style border 1px solid green div3 style position absolute div2 style pointer events none div3 style box sizing border box div3 style left 0px div3 style top mp y 10 px div3 style margin left 10px div3 style padding 5px div3 style border radius 5px div3 style display inline div3 innerHTML comment box div3 contentEditable true div3 onmouseenter function div2 style display none end addcomment let text a cat called test cat let safeText text replace a zA Z n g console log text console log safeText