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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:24:01+00:00 2026-05-25T01:24:01+00:00

I have this piece of code, but can’t seem to get it working. success:

  • 0

I have this piece of code, but can’t seem to get it working.

success: function(){
$(‘.like’).find(‘.like’+like_id).attr(“src”, “/img/icons/checked.gif”);
…etc.

.like is the class for all the images. OnClick I would like to have the img + id changed. It keeps changing all the images with class .like.

Even when using this, it is passing the right ID, but still changing all the .like images instead of the one with the right id:
var value = $(this).attr ( “id” );

Any help is highly appreciated!

  • 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-25T01:24:01+00:00Added an answer on May 25, 2026 at 1:24 am

    Your problem is that with find(‘.like’+like_id) you are finding every item that has the class like10 (for like_id 10). what you want is $('#'+like_id).attr();. What you want to consider is that an id must be unique within the whole html element, so using only the unqiue_id as id is not the best way. A better way would be <img src="" class="like" id="like1"> and then using $('#like'+like_id).attr();

    So, you’re code could look like this:

    success: function(){
      $('#like' + like_id).attr("src", "/img/icons/checked.gif");
      ...
    }
    
    <img src"" class="like" id="like{unique nr}">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this piece of code I'm trying to get to display but no
I have this piece of code in my routine but it doesnt seem to
you must have seen this piece of code somewhere else too,but obviously there's no
I have this piece of code in a function. I want to print the
I have this piece of code for my images, so the opacity can lower
I have this piece of code to test a shellcode but I don't understand
I have this wonderful piece of code from here But if some one edits
nowadays I have this piece of code: #import C:\Users\Public\SoundLog\DLLs\ForPython\SoundLogDLL.tlb named_guids but I want to
This might be straight forward but im lost I have this piece of code
I have this piece of code: function MyFunction() { $.ajax({ type: POST, url: ajax.php,

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.