-1

I want to remove ui-draggable class from the DIV element. I am not sure how this 'ui-draggable' is added to my class.

shilovk
  • 11,718
  • 17
  • 75
  • 74
  • Hello and welcome to StackOverflow. Please take some time to read the help page, especially the sections named ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic) and ["What types of questions should I avoid asking?"](http://stackoverflow.com/help/dont-ask). And more importantly, please read [the Stack Overflow question checklist](http://meta.stackexchange.com/q/156810/204922). You might also want to learn about [Minimal, Complete, and Verifiable Examples](http://stackoverflow.com/help/mcve). – Carsten Løvbo Andersen Aug 21 '17 at 09:58
  • Possible duplicate of [jquery remove class](https://stackoverflow.com/questions/5712772/jquery-remove-class) – Alessandro Da Rugna Aug 21 '17 at 10:09
  • We are not sure either if you do not show us your code. – TGrif Aug 21 '17 at 10:30
  • do you wish to remove class or disable dragging? – Davor Mlinaric Aug 21 '17 at 12:00
  • Having my own class for swapping div elements in a GridView. It is working fine at the first time. But after moving into another view, it stops working – Developer Aug 21 '17 at 12:09

3 Answers3

1

The .ui-draggable class is being added by jQuery UI, because you're using its Draggable widget or something that depends on it. Removing the classname manually presumably isn't working because the jQuery widget is putting it back in place.

You probably shouldn't be trying to remove this class; instead override any undesirable styling by putting rules on a different classname attached to the same element.

(If what you're really trying to do is to disable dragging for a specific element, use $('div.foo').draggable( "disable" ); instead of removing classnames.)

Daniel Beck
  • 20,653
  • 5
  • 38
  • 53
0
$('div .ui-draggable').removeClass('ui-draggable');
N1gthm4r3
  • 755
  • 1
  • 11
  • 23
0

Just try using this

$("div").removeClass("ui-draggable");

or give your div tag an id and try this

$("#divid").removeClass("ui-draggable");
Abhishek N
  • 21
  • 6