jquery-ui resizable lazy call on event

jquery-ui resizable lazy call on event

Hi all, 
i have an element that is loaded and created on a user event.
My problem is,that if i call directly into the <script> tag, it works
  1. <script>
  2.  $('th').resizable();
  3.  </script>


if i call :
  1. <script>
  2. function callOnEvent() {
  3.        $('th').resizable();
  4. }
  5.  </script>
it just doesn't want to work.

The chrome console says " undefined is not a function"
How can i fix this ?!

***** the same error i had with jstree trying to reload it, and in other places that right now i don't remember.

Thanks 
AiU