What I was trying to do with var current_section = $(this).attr ("name"); was to create a variable that simply contained the "name" of the particular subsection, which I could then attach to "_tab" to pinpoint the currently selected tab. I cant use the ID because it has a different value, used for something else. I used the name attribute because it was convenient for creating that variable. Is this a bad idea, could that be screwing up the whole file? or is the name attribute inaccessible to jquery?
The bigger problem, it seems, is that nothing is running in that gallery.js file, not even the first few lines... $(".current_panel .image_area").removeClass("current_area"); $(".current_panel .image_area").hide(); $(".current_panel .intro").show(); $(".current_panel .intro").addClass("current_area"); $(".back_tab").hide(); These seem pretty straightforward to me and I don't understand why theyre not working. Im wondering if it cannot see the .current_panel class, and hence cannot .hide() or .show() its children. The class .current_panel is added when a main menu btn is clicked, and the script for that is in the other panels.js file, which, as I said, is running perfectly. If all the javascript on the site is run on page load, then there is no .current_tab class at the time, and hence nothing will happen. Is this a likely cause? and if so is there a way to only run gallery.js once a menu btn is clicked? I tried adding the contents of gallery.js to that click function in the other file, but as I said, it broke the whole file. Thanks, Andrew On Aug 9, 12:34 pm, Stephan Beal <sgb...@googlemail.com> wrote: > On Aug 8, 7:25 pm, "andrew.croce" <andrew.cr...@gmail.com> wrote: > > > var current_section = $(this).attr("name"); > ... > > $("#"+current_section+"_tab").addClass("current_tab"); > > This is wrong. The '#' searches by ID, not by name. Try (untested): > > > var current_section = $(this).attr("id");