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

  • SEARCH
  • Home
  • 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 678533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:09:36+00:00 2026-05-14T01:09:36+00:00

I’m trying to hook up the click event on a jQuery image carousel’s images

  • 0

I’m trying to hook up the click event on a jQuery image carousel’s images so that it updates a select list in the same document and sets the “selected” option to match the item that was clicked in the carousel. The “title” attribute on each of the carousel images matches at least one option in the select list (title is always unique).

For example:

1) carousel image titles are: image1, image2, image3

<div id="carousel">
<ul>
    <li><img src='folder1/screenshot.jpg' title=image1 /></li>
    <li><img src='folder2/screenshot.jpg' title=image2 /></li>
    <li><img src='folder3/screenshot.jpg' title=image3 /></li>
</ul>
</div>

2) select list options are…

<select id="myThumbs">
    <option>image1</option>
    <option selected="selected">image2</option>
    <option>image3</option>
</select>  

My existing code is below, which already binds the hover event to a preview div outside the carousel. I want to keep this behavior, and also add the click behavior to update the selected item in the options list so that it matches the title of the carousel image that was clicked.

$(function() {
    $("#carousel").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 6,
        mouseWheel: true,
            speed: 700
    });
$('#carousel').show();

$('#myThumbs').change(function() {
  var myImage = $('#myThumbs :selected').text();
 $('.selectedImage img').attr('src','../wp-content/themes/mytheme/styles/'+myImage+'/screenshot.jpg');
});

    $('#carousel ul li').click(function(e) {
    var myOption = $(this).children('img').attr('title');
    $('#myThumbs').addOption('Text', myOption);
    });

$('#carousel ul li').hover(function(e) {
  var img_src = $(this).children('img').attr('src');
    $('.selectedImage img').attr('src',img_src);  

}
,function() {
$('.selectedImage img').attr('src', '<?php echo $selectedThumb; ?>');});
});
  • 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-14T01:09:37+00:00Added an answer on May 14, 2026 at 1:09 am

    If you want to keep a 1:1 relationship between a select & an image you would need to reset all the select options and keep just the one you want so…

       $('#carousel ul li').click(function(){
        var myOption = $(this).children('img').attr('title');
        $('#myThumbs').addOption('Text', myOption);
         $('#myThumbs option').each(function(){
           if($(this).text()=myOption){
             $(this).attr('selected','true')
           }else{
             $(this).attr('selected','false')
           }
         }
    

    that code hasn’t been tested so you might need to tweak it.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the

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.