• Resolved TonyVitabile

    (@tonyvitabile)


    I’ve been building a plugin & I’ve been making good progress on it until today. And the issue involves using the jQuery tabs library on one of my plugin’s admin pages.

    I’ve got the following code in the plugin where the admin page is created:

    add_action( 'admin_print_scripts', 'load_scripts' );
    add_action( 'admin_print_styles' , 'load_styles' );

    And here’s load_scripts():

    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'jquery-ui-core' );
    wp_enqueue_script( 'jquery-ui-tabs' );
    wp_enqueue_script( 'jquery-ui-datepicker', AS_URLPATH . 'js/ui.datepicker.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ) );
    wp_enqueue_script( 'as_range-checks', AS_URLPATH . 'js/range-tests.js' );

    The jQuery datepicker, which I had to download & include in my plugin, works fine. as_range-checks is a JavaScript library I’m writing & isn’t involved in the problem.

    Here’s the JavaScript & the HTML on the page that generates the form for the admin page:

    <script type="text/javascript" charset="utf8" >
    	jQuery(document).ready(function($) {
    		$("#tabs").tabs();
    	});
    </script>
    
    <div id="tabs">
    	<ul class="tabNavigation">
    		<li><a href="#tab1">Tab 1</a></li>
    		<li><a href="#tab2">Tab 2</a></li>
    		<li><a href="#tab3">Tab 3</a></li>
    		<li><a href="#tab4">Tab 4</a></li>
    	</ul>
    . . .

    The problem is that the content of all four tabs are displayed all of the time. Clicking on the tabs brings you to the right part, but nothing I’ve tried makes the content of the tabs that are supposed to be hidden actually disappear.

    Does anybody have any ideas? I’m running WordPress MU 2.8.4a

    Thanks

    Tony

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter TonyVitabile

    (@tonyvitabile)

    OK, here’s a weird twist on this issue:

    I am using the NextGEN Gallery plugin on my website. I’ve been developing the plugin locally on my MacBook (running MAMP 1.7.something). The tabs on the NextGEN Gallery plugin are also broken on the local copy of the website. But they work fine on the production website. In the same browser.

    That tells me that the issue is something local and not in the code. But you got me as to what the problem could be.

    I’m going to stop worrying about it & move on. At a later time, when I’m pretty sure the plugin won’t crash the site, I’ll try it on the production host & see what happens.

    Tony

    Thread Starter TonyVitabile

    (@tonyvitabile)

    OK, yet another update. I just uploaded my plugin to my production server. I’m running WPMU 2.8.4a, so I just created a new blog & activated the plugin there. When my plugin is active, tabs don’t work at all! But when it’s inactive, they do work!

    So the problem is in my code.

    Help!

    Tony

    Thread Starter TonyVitabile

    (@tonyvitabile)

    More information that may or may not be important:

    When my plugin is installed, the little downward pointing triangles in the right hand corner of each item on the admin page menu don’t work. You know, the ones that cause the menu to expand & collapse? When you click on the menu item, the menu expands, but you can’t expand or contract them by clicking on that little triangle. When the plugin’s deactivated, everything works fine.

    Strange.

    Tony

    Thread Starter TonyVitabile

    (@tonyvitabile)

    Bump

    I need some help with this, folks. I don’t understand what I’m doing wrong. It looks like I’m doing everything correctly.

    Help!!

    Thread Starter TonyVitabile

    (@tonyvitabile)

    Well, I’ve got egg on my face. The issue was the code in my as-range-checks.js file. When I commented out the line that enqueues it into the header, the problem went away. I have to review that & figure out where the issue is, but at least it’s working.

    Thanks anyway

    Tony

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can’t get jQuery tabs to work on my admin page’ is closed to new replies.