Organising JavaScript / jQuery - alternative to using jQuery's live hookup -
Simple question (I hope). I have a page that contains links, when new content is loaded in a specific device. The content that loads (a partial view) has further links that fire the JavaScript code (jQuery).
I'm hooking up these links using the jQuery live
system. I have been recommended that I wire-up the buttons in partial sequences by inserting javascript directly into these sequences or by linking the onclick
handler directly to links (instead they have wires with jQuery above).
Is there a 'best practice' to hook the dynamic content?
I will argue against in-line javascript, it should be in a script tag or onclick handler. It is always recommended to separate your presentation from logic.
What to do in that example, I would say that your best bet would be to use a live event or to use the callback to provide additional functionality. REF:
Comments
Post a Comment