0

should we include event,ui in the resize function every time we use resize so it looks like function(event, ui) instead of doing just function(). In what cases do we not include them in. And what exactly is ui.element. I can't find ui.element in the documentation.

$('div').live({
    resize: function(event, ui){
   var height = ui.element.height();
   $('#wrapper_size').text(height);
}
Hussein
  • 42,480
  • 25
  • 113
  • 143

1 Answers1

4

You can use them, when you need them. You use event if you want to know what was clicked, if maybe alt or ctrl key are pressed... ui is defined by the jquery ui element. If you are using chrome, do following

console.log(event);
console.log(ui);

and Chrome will give you the object in a nice graph where you can browse through, if you dont need it, you dont have to use it.

ui.element doesn´t exist anymore as I know. Here is some more info Why am I getting a jQuery 'ui.element is undefined' error?

Community
  • 1
  • 1
Luke
  • 8,235
  • 3
  • 22
  • 36
  • Great explanation. And what is ui.element. What is element – Hussein Feb 05 '11 at 22:39
  • see my update about ui.element. Thanks for your acknowledgement – Luke Feb 06 '11 at 00:06
  • I don't ui.element is deprecated. I'm still able to use it in jquery 1.5 and ui 1.8.9. – Hussein Feb 06 '11 at 01:48
  • element should be the selector element you were using to create the jquery ui element. $("element") == ui.element. it should be the same as "this" in the inner function. It would be used by the ui widget in some kind. – Luke Feb 06 '11 at 01:52