JQuery UI Tabs with $ (document) .ready equivalent
I am trying to use jQuery UI tabs in the same way as the master page in ASP.Net. I have a custom javascript that needs to be run after each tab is loaded. I tried to have $ (document) .ready function on every page, but I read this bad practice and only seems to work in IE.
I know there is a load event, but I need the event to be specific to each tab, and I'm not sure how to do this, or if it is possible. I may have to go back to using and actual MasterPage with postback for every page load.
a source to share
Where did you read that this is bad practice?
Afaik, which has several $(document).ready()
, will simply make them a "merge" so that all the code that is in any of them will run. I don't remember if this is new in jQuery 1.3 , so you can check it out.
a source to share
It's a good practice to have several $().ready
, unless you break it down into several. In case the tab is loaded in ajaxily IMHO puts $ (document) .ready inside the loaded contentis probably the best way to do some tab-related actions. I use this to re-bind the newly loaded items as they are being entered into the newly loaded tab.
a source to share