0

If I want to handle .change event on all form elements, some sources recommend this:

$('#form_id :input').change(...)

But I realized the following works too:

$('#form_id').change(...)

But does it really? I tried to find this feature on jQuery API - change but if I look correctly, seems undocumented?

The change event is sent to an element when its value changes. This event is limited to <input> elements, <textarea> boxes and <select> elements.

zoranc
  • 2,410
  • 1
  • 21
  • 34
Tomas
  • 57,621
  • 49
  • 238
  • 373
  • 2
    The change event, like many other events, _bubbles._ – nnnnnn Mar 10 '14 at 09:54
  • 1
    [change](https://developer.mozilla.org/en-US/docs/Web/Reference/Events/change) event bubbles – Arun P Johny Mar 10 '14 at 09:55
  • can you provide link to those sources that recommend you change it? – JF it Mar 10 '14 at 09:57
  • @Raphaël, jQuery works around that: `As of jQuery 1.4, the change event bubbles in Internet Explorer, behaving consistently with the event in other modern browsers.` – Frédéric Hamidi Mar 10 '14 at 09:58
  • Possible duplicate of [What is event bubbling and capturing](http://stackoverflow.com/questions/4616694/what-is-event-bubbling-and-capturing). – Frédéric Hamidi Mar 10 '14 at 10:04
  • @Tomas - the sentence Frédéric Hamidi quoted is the documentation you are looking for. It's on the page you linked to, just before the examples. – nnnnnn Mar 10 '14 at 10:04

0 Answers0