How to prevent text select outside HTML5 canvas on double-click?


To avoid the double click text issue −

var canvas1 = document.getElementById('c');
canvas1.onselectstart = function () {
   return false;
}

Note − The Canvas should not fill the width of the page and it is only 100 pixels wide.

Updated on: 25-Jun-2020

224 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements