0

GWT Query selector i.e. $("#id") not working inside callback function. However xyz.find("#id") works, where xyz -> Gquery variable. Is it that callback function doesn't support $ selector or is there some other problem.

archangel
  • 93
  • 1
  • 1
  • 8

1 Answers1

0

Are you sure that the element with id "id" is attached to the dom when the callback function is called ?

When you execute $("#id"), gQuery try to find elements matching the selectors within the set of elements of the DOM tree . When you execute xyz.find("#id"), gQuery try to find elements matching the selectors inside the array of elements selected by xyz no matter the elements are still or not in the dom tree.

jdramaix
  • 1,104
  • 6
  • 9
  • Seems stupid, but thanks for pointing this out. The problem was that, the id wasn't actually being attached to the dome like you mentioned, so $('#id') wasn't working and since I had the original element with me, so xyz.find('#id') was working. – archangel Jul 09 '13 at 04:38