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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:10:25+00:00 2026-06-14T11:10:25+00:00

Basically I want to bind a bunch of checkbox items or items in a

  • 0

Basically I want to bind a bunch of checkbox items or items in a listbox to a set of corresponding custom images, so that when I click or select multiple images, it selects or checks the corresponding listbox/checkbox item.

The example below, works only on a lsitbox, but it doesn’t select multiple items. http://jsfiddle.net/tnkboy/hvfF9/

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JQuery Dropdown Selection</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="styles.css" type="text/css">

<style type="text/css">
body { background-color:#efefef; font-family:Arial, Helvetica, sans-serif; margin:60px; }

h2 { background: url(1326911803_kteatime.png) no-repeat; line-height:38px; padding:0 0 0 50px; font-size:18px; color:#666; }

ul#customselect { margin:0; padding:0; display:block; height:auto; overflow:hidden; margin:0 0 20px 0 !important; }

ul#customselect li { float:left; display:inline-block; margin:0 10px 0 0; cursor:pointer; }

#customselect li a { width:60px; height:60px; padding: 5px; background:#FFF; float: left; border:6px solid #CCC; border-radius:12px; text-decoration:none; text-align:center; font-weight:bold; color:#666; font-size:38px; letter-spacing:-2px; }

#frm_options { clear:both; display:block; }

#customselect li a span { display:block; font-size:11px; letter-spacing:0; }

.selected { border: 6px solid #4a7329 !important; color:#4a7329 !important; background:#dbeccd !important; }

</style>
</head>
<body>
<form action="#" method="post">
  <h2>How do you take it?</h2>
  <ul id="customselect">
    <li><a href="1" class="link">0 <span>Sugar</span></a></li>
    <li><a href="2" class="link">1 <span>Sugar</span></a></li>
    <li><a href="3" class="link">2 <span>Sugars</span></a></li>
  </ul>
  <select name="options" id="frm_options" multiple>
    <option value="Nothing Selected">Nothing Selected</option>
    <option value="1">No Sugar</option>
    <option value="2">1 Sugar</option>
    <option value="3">2 Sugars</option>
  </select>
  <div >
  <INPUT NAME="options" TYPE="CHECKBOX" value="1"> Option 1<BR>
  <INPUT NAME="options" TYPE="CHECKBOX" value="2"> Option 2<BR>
  <INPUT NAME="options" TYPE="CHECKBOX" value="3"> Option 3<BR>
    </div>
</form>

<script type="text/javascript">
    $(document).ready(function() {
        $('.link').click(function() { 
            $('#frm_options').val($(this).attr('href')); 
            $('.link').removeClass('selected');
            $(this).addClass('selected'); 
            return false; 
        });
    });
</script>
</body>
</html>

Thanks.

  • 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-14T11:10:26+00:00Added an answer on June 14, 2026 at 11:10 am

    I updated your fiddle to select multiple items, see it here http://jsfiddle.net/gnel/hvfF9/1/

    Code below:

    $(document).ready(function() {
              $('.link').click(function() {
                elem = $('#frm_options [value='+$(this).attr('href')+']');
                  if (elem.is(':selected')) {
                      elem.removeAttr('selected');
                      $(this).removeClass('selected');
                  } else {
                      elem.attr('selected','true');
                      $(this).addClass('selected');
                  }
                return false;
            });
        });
    

    UPDATE:
    I added support for selecting/deselecting individual items on the list, see http://jsfiddle.net/gnel/hvfF9/2/

    Added code below:

    $('#frm_options option').on('mousedown', function() {
            elem = $('#customselect .link[href='+$(this).val()+']');
            if ($(this).is(':selected')) {
                $(this).removeAttr('selected');
                elem.removeClass('selected');
            } else {
                $(this).attr('selected','true');
                elem.addClass('selected');
            }
            return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have XAML like this.. Basically it concatenates multiple strings that bind to different
I basically want to take a bunch of names in a collection and bind
I want to set up data binding using a custom component. Basically, I'd like
I basically want to be able to deploy multiple versions of the same EAR
I basically want to open a browser window from Word using VBA that does
Basically I want to be able to call jQuery from FireBug, place code that
What I want is to bind a string to a textblock or datatrigger (basically
Let me describe the thing that I want to accomplish: I basically want to
I have a custom component that is basically a text box with an attached
I basically want something like: TextView Button Button . . . TextView TextView SeekBar

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.