0

I've loaded a <textarea> with javascript,

and need to focus on it as soon as it's available.

The live() in jQuery must specify a "type" which doesn't exists in my case.

I need to do something like below:

$('#target').onAvailable($('#target').focus());

How to implement this with jQuery?

seth
  • 36,759
  • 7
  • 60
  • 57
omg
  • 136,412
  • 142
  • 288
  • 348

1 Answers1

2

Use a callback:

$("...").load("/something/to/load.html", function() {
  $("textarea", this).focus();
});
cletus
  • 616,129
  • 168
  • 910
  • 942