Selecting a jquery tab from javascript based on the url parameter
I am using struts jquery plugin in my application.
I have a jsp page which is rendering the tabs
<sj:tabbedpanel cssClass="customtabbedpanel" id="tasks" >
<sj:tab cssClass="customtab" id="list_tasks" href="task_list" label="Task List" />
<sj:tab cssClass="customtab" id="task_create" href="new_task?type=task_create" label="Create Task "/>
</sj:tabbedpanel>
By default the first tab will be selected and the data returned by the server in the task_list call will be displayed.
I have a requirement , that the tab should be selected based on the parameter in the url . for ex if in the url we give the param as action=create the 2nd tab should be loaded.
I tried to do this from javascript in the document.ready
using the following code
$("#tasks").tabs('load', 2);
however this doesnt seem to work.
Is there any way of invoking the tab based on a url parameter?