0

I want to have some code run when i change the selection of a dropdown. i see the livequery plugin states that this is needed to support as some browsers don't do it out of the box

Do I really need livequery to capture onchange event of a dropdown that i create dynamically or does the regular live syntax work in all browsers?

leora
  • 188,729
  • 360
  • 878
  • 1,366

3 Answers3

2

live takes advantage of event bubling mechanism so we can attach event handlers to elements which are created dynamically also, it will work as expected since it attaches event to the document element and listens to them. But I believe change event is not bubbled upto the dom tree so it may not work.

ShankarSangoli
  • 69,612
  • 13
  • 93
  • 124
  • as per my question, I AM creating the dropdown dynamically so i atleast need live() – leora Aug 28 '11 at 20:19
  • the answer seems to not reflect reading the full question which clearly states the fact that its dynamic and live syntax in the question. Let me know if that doesn't justify down vote – leora Aug 28 '11 at 20:24
  • You can take a look at this answer, the `change` event is not bubbled up in all the browsers http://stackoverflow.com/questions/265074/does-the-onchange-event-propagate – ShankarSangoli Aug 28 '11 at 20:29
  • done. except that it doesn't seem like you can remove a down vote, you have to actually create an upvote. No issue with that but it is interesting that you can't remove a vote anywhere unless i am missing something. – leora Aug 28 '11 at 20:30
0

from this page, it looks like you need livequery for it to work in IE

leora
  • 188,729
  • 360
  • 878
  • 1,366
-1

No. You should be able to use just the standard jquery api.

for the dynamic elemenets use .live('change', function to capture the event.

Mindfulgeek
  • 141
  • 4
  • that doesn't seem to work in IE, based on this page: http://loonyblurb.net/2009/06/jquery-live-livequery/ – leora Aug 28 '11 at 20:37