Hi, I have the following jQuery function on the head of my page. <script type="text/javascript"> jQuery.noConflict(); /* calling jNice on document ready */ jQuery(document).ready(function($) { $(''div.jNice'').jNice(); }); ..... </script> On page load, this gets called correctly. Now there''s a link on the page that lets me add more rows and i do this via RJS. Here''s the code. <tr id="empty_item"> <div id="plussign"><%= add_item_link "+" %></div> </tr> def add_item_link(name) link_to_function name do |page| page.insert_html :before, :empty_item, :partial=>''item'', :object => Item.new end end Now this partial ''item'' contains form elements upon which jNice needs to work its magic. How can I call the jNice function after the user clicks on the add_item_link? Thanks.
anyone?? anything? On Aug 7, 4:36 pm, Ram <yourstruly.vi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I have the followingjQueryfunction on the head of my page. > > <script type="text/javascript"> > jQuery.noConflict(); > > /* calling jNice on document ready */ > jQuery(document).ready(function($) > { > $(''div.jNice'').jNice(); > }); > ..... > </script> > > On page load, this gets called correctly. > > Now there''s a link on the page that lets me add more rows and i do > this via RJS. Here''s the code. > > <tr id="empty_item"> > <div id="plussign"><%= add_item_link "+" %></div> > </tr> > > def add_item_link(name) > link_to_function name do |page| > page.insert_html :before, :empty_item, :partial=>''item'', :object > => Item.new > end > end > > Now this partial ''item'' contains form elements upon which jNice needs > to work its magic. > > How can I call the jNice function after the user clicks on the > add_item_link? > Thanks.
enter live(). implementing this function solved my problem. http://docs.jquery.com/Events/live#typefn On Aug 10, 9:47 am, Ram <yourstruly.vi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> anyone?? anything? > > On Aug 7, 4:36 pm, Ram <yourstruly.vi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > I have the followingjQueryfunction on the head of my page. > > > <script type="text/javascript"> > > jQuery.noConflict(); > > > /* calling jNice on document ready */ > > jQuery(document).ready(function($) > > { > > $(''div.jNice'').jNice(); > > }); > > ..... > > </script> > > > On page load, this gets called correctly. > > > Now there''s a link on the page that lets me add more rows and i do > > this via RJS. Here''s the code. > > > <tr id="empty_item"> > > <div id="plussign"><%= add_item_link "+" %></div> > > </tr> > > > def add_item_link(name) > > link_to_function name do |page| > > page.insert_html :before, :empty_item, :partial=>''item'', :object > > => Item.new > > end > > end > > > Now this partial ''item'' contains form elements upon which jNice needs > > to work its magic. > > > How can I call the jNice function after the user clicks on the > > add_item_link? > > Thanks.
Maybe Matching Threads
- javascript using jQuery.js and prototype.js doesnt work 2get
- mysql gem install not happening on Mac OS Leopard - any inputs at all??
- Observing few fields in a form - Best Practise?
- Preventing a submitted hash from ActiveRecord DB store
- daemons load activesupport 2.2.2 instead of 2.1.0, causing failure