I want to use jqueryui tabs widget in ajax requested page. In my si开发者_开发知识库te people click a date on clendar. when they click on a date scripts get ajax page of the day. In ajax page user can select a tab to see birthdays and events on different tabs. I try to do this but jqueryui tbs which is in the ajax requested dynamic page is not working properly and open tabs in new page. How can i do this
If you post some code up, people maybe able to help - post the relevant code which you have so far which doesn't work.
As a guess though, when you finish loading the ajax request, you will need to initiate the jQuery UI tabs. Alternatively you will need to use .live()
and possibly attach to the click to the tab to initiate the tabs if they haven't already been.
The reason is, any code you run in your scripts are on DOM items when the page is loaded, anything loaded afterwards (.ajax()
) isn't affected by what you originally did in your script.
So for example if you setup tabs up on page load using $('#example').tabs();
, then you load a <div id="example"><ul><li>......</li></ul></div>
using .ajax()
the <div....
won't be tabs like you want and will do what you describe.
If you do the same initiation in the success: function(data) {.........$('#example').tabs();}
callback of the .ajax()
function it will initiate the newly loaded item as a tab.
精彩评论