rotate text with jquery

rotate text with jquery

i add rotate functionality to one of my application but it is not working right i want to add it only to active div onclick of other div rotate fuction get removed here is the code:
  1. $("#rotate").click(function () { // Your original element var ele = $("li.active"); // Create handle dynamically $('<div></div>').appendTo(ele).attr('id','handle').css({ 'position': 'absolute', 'bottom': 0, 'right': 0, 'height': 10, 'width': 10, 'background-color': 'red' }); ele.css('position', 'relative'); $('#handle').draggable({ handle: '#handle', opacity: 0.01, helper: 'clone', drag: function(event, ui){ var rotateCSS = 'rotate(' + ui.position.left + 'deg)'; $(this).parent().css({ '-moz-transform': rotateCSS, '-webkit-transform': rotateCSS }); } }); });

here is jsfiddle link : http://jsfiddle.net/P2Kyk/36/