views:

20

answers:

2

Let's say I have a div that when it's clicked on it adds the .resizable() function to the div, thus being able to be resized. Would anyone have a code example of this? Thanks!!

A: 

should be

$('#divid').bind('click', function(){
   $(this).css('border', '#000 1px dotted').resizable();
});

I added a dotted border for the case there is none (makes it dramatically more easy to resize :) )

jAndy
+1  A: 

Hopefully this will do:

jQuery

<script type="text/javascript">
  $(document).ready( function() {
    $("#clickme").click(function() {
      $("#makethisresizable").resizable();
    });
  });
</script>

CSS

<style type="text/css">
  #makethisresizable {
    width: 100px;
    height: 100px;
    background: blue;
    color: white;
  }
</style>

HTML

<div id="clickme">Click me</div>

<div id="makethisresizable">Make this resizable</div>
Gert G