javascriptjquery

uncaught exception: cannot call methods on tabs prior to initialization


I am using the following code to change the tab color on click

  $("ul.tabs").tabs("> .pane");

but it is throwing the error

uncaught exception: cannot call methods on tabs prior to initialization; attempted to call method '> .pane'

Could somebody help me with this what is this error?


Solution

  • You need to initialize the tab with the code below:

    function(){
    $("ul.tabs").tabs();
    }
    

    or with:

    $("ul.tabs").tabs().tabs($("div.panes > div"), action);