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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:23:40+00:00 2026-06-05T14:23:40+00:00

i have a select with some options generated from content: <select style=color: #444;> <?php

  • 0

i have a select with some options generated from content:

  <select style="color: #444;">
<?php

$select_optd = 0;
foreach($DATA as $EACHOPTION){

// Checking some internal stuff, this works
if(IFISVALID){ // Now lets say it is valid, it will output some options

            // Option echo
    echo '<option';

            // Some code to show the first option as selected and setting some
            // later needed POST javascript variables
    if($select_optd == 0){
    echo ' selected="selected" ';
    $select_optd = 1;   
    $show_ctrl_id = $EACHOPTION['id'];
    $show_ctrl_spot = $EACHOPTION['spot'];
    }

            // echo the option html data

    echo  ' id="PRJ_OPT_'.$EACHOPTION['id'].$EACHOPTION['spot'].'" >';
    echo $EACHOPTION['title'] . ' - Spot: ' . $EACHOPTION['spot'];
    echo '</option>';

    ?>

    <script type="text/javascript">
            // Now the Javascript for when the option is selected
    $(document).ready(function(){   

    $('#PRJ_OPT_<?php print($EACHOPTION['id']); print($EACHOPTION['spot']);?>').click(function(){

            // An image showing the option selected     
    $('#PRJ_IMG_SHOW').attr('src','<?php print($EACHOPTION['image_url']); ?>'); 

            // Some posting inputs for later on
            $('#w_prj_id_send').val('<?php print($EACHOPTION['id']); ?>');
    $('#w_prj_spot_send').val('<?php print($EACHOPTION['spot']); ?>');

            // An alert to test if it's working  
    alert('Changed');
        });

    }); 
    </script>

    <?php   
    }else{ // that option was not valid, next one. }

} // End of Foreach
?>
</select>

The problem is this .click() event on the options is only working on firefox. I’ve tried on Chrome, IE… only works Firefox.

Is there any resolution or explanation for this problem?

// —————————————————————– //
RESOLUTION:

<script type="text/javascript">
    $(document).ready(function(){   

        $('#prj_selector').change(function(){
        var SELECTED_PRJ = $('#prj_selector').val();    

        <?php
        foreach($DATA as $EACHOPTION){
        ?>  
            if(SELECTED_PRJ == '<?php echo $EACHOPTION['title'] . ' - Spot: ' . $EACHOPTION['spot']; ?>'){
            $('#PRJ_IMG_SHOW').attr('src','<?php print($EACHOPTION['image_url']); ?>'); 
            $('#w_prj_id_send').val('<?php print($EACHOPTION['id']); ?>');
            $('#w_prj_spot_send').val('<?php print($EACHOPTION['spot']); ?>');
            }
        <?  
        }
        ?>                      

        });
    }); 
</script>
  • 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-05T14:23:42+00:00Added an answer on June 5, 2026 at 2:23 pm

    Because <select> is a control, not a normal element.

    Use .change() instead on the select element itself.

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

Sidebar

Related Questions

Say that I have some SELECT statement: SELECT id, name FROM people ORDER BY
I have the problem, that MSSQL Server 2000 should select some distinct values from
I have some options for pricing using radio buttons. When a user selects the
I have some markup similar to the following: <select> <option selected=selected>Apple</option> <option selected=>Orange</option> </select>
What I have is a mySQL query that will select some drinks and return
I have a gtk.Textview . I want to find and select some of the
Suppose i have 1kk records in my database. Now i need to select some
i have one form which have some input box and some select box. i
I have some problems sending an id though jquery. I have a form select
I have a select table that is generated using view : <select id =

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.