Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4096534
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:03:31+00:00 2026-05-20T20:03:31+00:00

This all seems to work great just the really strange thing is when I

  • 0

This all seems to work great just the really strange thing is when I try to reference the var with .html(‘g’+index) it throws an object expected error. I guessing building the var isn’t the best thing?

var g0 = "<?php getFiles("gallery/Audience"); ?>";
var g1 = "<?php getFiles("gallery/Exhibition"); ?>";
var g2 = "<?php getFiles("gallery/registration"); ?>";
var g3 = "<?php getFiles("gallery/Speakers"); ?>";

$(".galleryButton").each(function (index) {
    $(this).click(function(){
        $('#galleria').html();                              
        $('#galleria').html('g'+index);
        initiateGallery();
    }).mouseover(function() {
        $(this).css('cursor', 'pointer');
        $(this).css('backgroundColor', '#002E53');
    }).mouseout(function(){
        $(this).css('backgroundColor', '#000');
    });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:03:32+00:00Added an answer on May 20, 2026 at 8:03 pm

    You could use eval to get the value of the variable gx.

    $(this).click(function(){
        $('#galleria').html();                              
        $('#galleria').html(eval('g'+index));
        initiateGallery();
    })
    

    But as eval is evil you should use a switch-case to get the variables:

    $(this).click(function(){
        $('#galleria').html();
        var contents;
        switch(index) {
            case 1:
                contents = g1;
                break;
            case 2:
                contents = g2;
            ...
        }
        $('#galleria').html(contents);
        initiateGallery();
    })
    

    I guess that you’re trying to clear the html of #galleria with this line:

    $('#galleria').html();
    

    You should pass an empty string to html() to clear the content:

    $('#galleria').html('');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just came up with this, it seems to work in all modern browsers,
This seems to happen all the time to me: I work on the parent
Hi all I can't find the error in this table creation bit, seems really
hello all this seems to be my problem I have a table in mysql
Ok, so, im having trouble with this program im writing, it all seems to
This seems confusing to me - im creating a class library, and adding all
Sorry if this question seems a bit complex but I think its all related
I know this seems like a repeat question, but i've read all the others
Seems I've outdone myself. All the while I was creating this pretty little 'latest
([\'])(?:\\\\?+.)*?\\1 I came up to this regexp to match all quoted strings.. It seems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.