I want to have access to the 'result' variable outside the first function. knowing that it's value is a Unicode such as 'ﺏ'. as I am new to this I ask for your Help. thanks.
here is my code. alert(r) shows an empty diologue box:
    var result = '';
    $( document ).ready(function() {
        $( function() {
            $( "#draggable" ).draggable({ snap: ".baseline, .BF, .AF"});
            $( "#draggable2" ).draggable({ snap: ".baseline, .font"});
            $( "#draggable3" ).draggable({ snap: ".baseline, .font"});
            $( "#selectable" ).selectable();
        });
        $( "#selectable" ).selectable({
            stop: function() {
                var result='';
                $('.ui-selected').each(function() {
                    result += $(this).text();
                 });   
            $("#result").html(result);
            $("#harf").html(result);
           }
        });
       $( "#draggable, #draggable2, #draggable3" ).draggable({
          drag: function() {                   
            alert(result);
          }
       });
  });
 
     
    