document.getElementById('div1').setAttribute('draggable', false);
OR
var elem = document.getElementById('div1');
elem.setAttribute('draggable', false);
If you want the attribute to completely disappear,
elem.removeAttribute('dragable');
user1467267
source
share