How to perform multiple actions on the same element using jquery

950 views Asked by At

how do I include both drag and resize on a single element.

<head>
<style type="text/css">
  #header { width: 200px; height: 100px; background: blue; }
</style>
<script>
  $(document).ready(function() {
    $("#header").draggable().resizable();
  });
</script>
</head>
<body style="font-size:100%;font-weight:bold;font-style:times" >

    <div id="header">

      <label> Header <input type="text" value="headerBox" /> </label>
      <input type="button" value="submit" id="headerSubmit" name="submit" />
      <input type="reset" value="reset"/>

    </div>

    </body>
    </html>
2

There are 2 answers

1
Vivek On BEST ANSWER

both draggable and resizable supports chaining mode so you can simplify your code in one line

$(document).ready(function() {

    $("#header").draggable().resizable();
 });

see demo here.... DEMO
refer this tutorial for more information .....Draggable and resizable

0
Rafay On
$(document).ready(function() {

 $("#header").draggable();
$("#header").resizable();

 }); 

see if it works