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 8489695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:53:58+00:00 2026-06-10T21:53:58+00:00

As odd as it may seem I have a part of my script that

  • 0

As odd as it may seem I have a part of my script that looks like this… php is controlling access to my jQuery function; please excuse the fact that there maybe some redundant code here, but allow me to explain the main issue here.

Here is a code excerpt of php:

<?php
        if($user_info['ACTIVE'] == 'Y')
            {
                require("jQuery/main_function.js");
                require("edit_profile.php");
            }elseif(!isset($_GET['resend']))
            {
                echo '<div id="profile_info"><p>In order to modify or setup your seller profile your account must be activated.<br />
                Check your email; if you did not receive an email, <a href="profile.php?resend">Click here</a> to have another one dispatched.</p>';
                echo '<p>You can however complete your contact information <a href="user_contact.php">here</a>';
            }

As you can see in the php code, if the user is active, as determined from a database call, it will require main_function.js in the html, thus dropping this:

<script type="text/javascript">
function option_click(elementId)
    {
        $(document).ready(function(){
            alert('testing1');
            var defaultString = "Upload";
            var elementNum = elementId.substr(elementId.length-1, 1);
            switch($('#'+elementId).val())
            {
                case 'Video':
                {
                    alert('testing in chrome');
                    $('.set_time'+elementNum).prop('type', 'hidden');
                    $('.product_upload'+elementNum).prop('type', 'file');
                    $('.content_upload'+elementNum).html(defaultString + ' a ' + 'video file:');
                    break;  
                }
                case 'Time':
                {
                    $('.content_upload'+elementNum).html('How much time?');
                    $('.product_upload'+elementNum).prop('type', 'hidden');
                    $('.set_time'+elementNum).prop('type', 'text');
                    break;
                }
                case 'Music/Audio':
                {
                    $('.set_time'+elementNum).prop('type', 'hidden');
                    $('.product_upload'+elementNum).prop('type', 'file');
                    $('.content_upload'+elementNum).html(defaultString + ' a ' + 'music file');
                    break;
                }
                case 'Ebook':
                {
                    $('.set_time'+elementNum).prop('type', 'hidden');
                    $('.product_upload'+elementNum).prop('type', 'file');
                    $('.content_upload'+elementNum).html(defaultString + ' an ' + 'ebook file');
                    break;  
                }
                case 'Tutorial/Docs':
                {
                    $('.set_time'+elementNum).prop('type', 'hidden');
                    $('.product_upload'+elementNum).prop('type', 'file');
                    $('.content_upload'+elementNum).html(defaultString + ' a ' + 'tutorial file');  
                    break;
                }
            }
        });
    }
</script>

in the middle of my code…

Works fine in all browsers except google chrome? Why?

  • 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-06-10T21:54:00+00:00Added an answer on June 10, 2026 at 9:54 pm

    You are swirching option’s value like

    switch($('#'+elementId).val())
    

    but in your element (option) I didn’t see any value assigned (from the comment you provided)

    <option id="video0" onclick="option_click(this.id)">Video</option>
    

    Update:

    Your approach (not working in Chrome)

    <select>
       <optgroup label="Swedish Cars">
           <option id="volvo" onclick="option_click(this.id)">Volvo</option>
           <option id="saab" onclick="option_click(this.id)">Saab</option>
       </optgroup>
    

    DEMO.

    Proper way (Working in all browsers)

    <select onchange="option_click(this.value)">
        <optgroup label="Swedish Cars">
            <option value="volvo" id="volvo">Volvo</option>
            <option value="saab" id="saab">Saab</option>
        </optgroup>
    </select>
    

    DEMO.

    An example with switch statement here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this may seem odd, but I actually need a PHP script that WILL time-out,
This may seem like an odd question, but I have my own reasons for
This may seem like an odd question but I was talking to a friend
This may seem like an odd question, but I need to find a closed-source
This may seem like an odd one, but I want to be able to
This may at first seem like an odd question, but when a cin request
This may seem like an odd thing to ask, but it'd take me forever
This may seem like an odd question, but does anyone know the origin of
This may seem an odd thing to want to do but ignoring that, is
This may seem like an odd question, but it's something I couldn't solve on

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.