How to make html textbox draggable and mutable using jQuery UI plugins?

Using the plugin jquery ui draggable, I created an html text field draggable in this way:

<script type="text/javascript" language="javascript">
    $(document).ready(function() {
        $("#Text1").draggable({
            containment: "parent",
            cancel: null
        });
    });
</script>

<form id="form1" runat="server">
<div>

    <div id="dialog" title="Dialog Box" style="border: solid 1px black;">
        <input id="Text1" type="text" style="width: 200px; height: 20px;" value="Text1" />
    </div>

</div>
</form>

But how to make it mutable with jQuery?

Thanks in advance.

Goran

+3
source share
2 answers

Here is a DEMO to make an HTML text box and using resizabledraggablejquery-ui

HTML:

<div id="container" class="ui-widget-content">
<h3 class="ui-widget-header">Containment</h3>
<span id="draggable">*  
<input type="text "id="resizable" class="ui-state-active" value="This is input box">
</span>
</div>

JS:

$(function() {
     $( "#resizable" ).resizable({
containment: "#container"
});
     $( "#draggable" ).draggable({containment: "#container"});
});
+4
source

Using jQuery UI.
HTML FILE
<input type="text" id="resizable" />
JavaScript file link to all the necessary jQuery files in the script tag ie

<script src="*all needed .js files*"></script>

<script>
    $(function() {      
    $( "#resizable" ).resizable();
});
</script>

by the way why do you need to resize the text box

+2
source

All Articles