tags:

views:

614

answers:

1

I have a textarea that I've set to draggable, but it's not... The browsers I've tested (FireFox 3 and Safari 3 on OS X) think I'm trying to select the text inside the textarea (even when there is none).

I would like to allow for clicking inside the textarea to position the cursor for editing, but a dragging movement should be handled by jquery-ui.

Example html which is not doing what I want below...

    <html>
    <head>
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.7.custom.min.js"></script>
     <script type="text/javascript">
    $(function(){
            $("div").draggable();
            $("textarea").draggable();
    });
    </script>
    <style type="text/css">
    div {
            position:               fixed;
            top:                    100px;
            left:                   100px;
            width:                  100px;
            height:                 100px;
            background-color:       blue;
    }
    textarea {
            width:                  80%;
            height:                 80%;
            background-color:       yellow;
            resize:                 none;
    }
    </style>        
    </head>
    <body>
    <div>
    <textarea>Pirates spotted!</textarea>
    </div>
    </body>
    </html>
A: 

You might consider using the jQuery-UI dialog library and position a textarea within. You can make the dialog draggable.

james