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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:45:34+00:00 2026-05-17T16:45:34+00:00

i have this jquery code which works fine, but the image at the end

  • 0

i have this jquery code which works fine, but the image at the end is not changing to the src i specified here:

jquery:

    $(document).ready( function() {
      $("a.vote_up").click(function(){
        //get the id
        var the_id = $(this).attr('id');

        //the main ajax request
        $.ajax( {
          type: "POST",
          data: "action=vote_up&id=" + the_id,
          url: "ajax/votes.php",
          success: function( msg ) {
            $("span.vote_count#"+the_id).html(msg).fadeIn();
// my problem is here 
            $(".vote_up#" + the_id + " img").attr("src", "img/upvoteActive.png");
          }
        } );
      } );
    } );

the html code:

<a href='#' class='vote_up' id="$id"><img src="img/uparrow.png" /></a>
  • 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-17T16:45:34+00:00Added an answer on May 17, 2026 at 4:45 pm

    Don’t use class in combination with ID; it is redundant because ID should always be unique…

     $("#" + the_id + " img").attr("src", "img/upvoteActive.png");
    

    Also, you cannot use the character $ in the ID attribute. To quote the W3C on the ID attribute…

    ID and NAME tokens must begin with a
    letter ([A-Za-z]) and may be followed
    by any number of letters, digits
    ([0-9]), hyphens (“-“), underscores
    (“_”), colons (“:”), and periods
    (“.”).

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

Sidebar

Related Questions

I have the following code, which works fine in FF, but the .append() function
I have this javascript code which works fine var QuestionID = panel.siblings('.QuestionIDWrapper').children('input[type=hidden]').val(); but if
On my main page I have this jquery code which does an ajax call
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody
i have this javascript code to which i want to add the jquery fade-in
We have this anonymous function in our code, which is part of the jQuery's
I have got a drop down menu which works fine but i want to
I have following code on my site: backgroundImages[bg_img_path_b]=new Image(); backgroundImages[bg_img_path_b].src = bg_img_path_b; backgroundImages[bg_img_path_b].loaded=loading; //jQuery(backgroundImages[lastImage]).unbind('load.backgroundImages');
I have added tinyMCE to my django admin which works fine but now I
I have a menu and jquery-code, which makes its background-image different when hover. $('#menu

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.