say have jquery object, el, has selected element. legal, safe, , reasonable call el.trigger("change") if selected element div? other element types? matter, can call el.change()?
the jquery documentation .change() says:
the change event sent element when value changes. event limited <input> elements, <textarea> boxes , <select> elements.
it's not clear me "limited" means here. might referring fact these 3 element types produce these events automatically, instead mean other elements aren't allowed to.
empirically, chrome v28 seems allow it, want know if can expect work in general.
goal
i have pseudo-control that's composed of set of buttons , spans wrapped in div. each instance of control maintains , manages value, modified clicking control's buttons. when value changes, need send event out div rest of page can react. don't want listen click events outside control, since couples surrounding code controls' internals , not clicks change value.
i create new event name, built-in "change" event seems conceptually correct, i'd rather use if can. added bonus, page "change" handler bound right place right behavior (because have input , select controls on page, too).
i need support ie8 , up, in case answer varies browser make , version.
there no restrictions, can trigger event type on html element.
jquery documentation telling change automatically triggered on <input>, <textarea> , <select>
Comments
Post a Comment