Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
71
rated 0 times [  78] [ 7]  / answers: 1 / hits: 29321  / 11 Years ago, thu, april 4, 2013, 12:00:00

So the question is : How can you do that ? I want to change the draggable attribute to false so the element that was previously draggable will lose this property.



I will give you a div so you will have something to start with :



     <div id=div1  draggable=true ondragstart=drag(event) onDblClick=edit('div1')>
</div>

More From » html

 Answers
10
document.getElementById('div1').setAttribute('draggable', false);


OR



var elem = document.getElementById('div1');
elem.setAttribute('draggable', false);


If you want the attribute totally gone use;



elem.removeAttribute('dragable');

[#79128] Tuesday, April 2, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dominickmackenziet

Total Points: 583
Total Questions: 101
Total Answers: 117

Location: Saint Lucia
Member since Wed, Feb 8, 2023
1 Year ago
dominickmackenziet questions
Wed, Apr 7, 21, 00:00, 3 Years ago
Fri, Feb 12, 21, 00:00, 3 Years ago
;