4

I am trying to figure out the best and most inexpensive way to attach jQuery plugins and some basic UI setup functions.

Currently, I can think of two ways:

1) Fire a function after rendering the view. This means that each time the view is rendered, the plugins, etc are re-attached. Could this cause memory, etc issues?

2) Somehow mimic jQuery .live() for plugins... I don't know if that's even possible

Any ideas?

ragulka
  • 4,312
  • 7
  • 48
  • 73
  • Normally you'd do this sort of thing in `render`. And you don't have to redraw the whole view when only part of it changes, you can update things piecemeal. – mu is too short Feb 15 '12 at 00:16
  • Updating only a part wouldn't work in my case because the view template can be customized by the end users - there's no way of telling what kind of elements they put the values in. – ragulka Feb 15 '12 at 06:36

1 Answers1

0

Keep in mind that jQuery.live is deprecated and you should use jQuery.on instead, see: http://api.jquery.com/delegate/ Anyway you may find some interesting solutions here: Detect element content changes with jQuery

Community
  • 1
  • 1
luacassus
  • 6,540
  • 2
  • 40
  • 58