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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:59:21+00:00 2026-06-01T19:59:21+00:00

i wnt to swap image on click,bt here if m clicking from down image

  • 0

i wnt to swap image on click,bt here if m clicking from down image to up but again its not coming on down image if m clicking on that image…
m geting some error-x.attr(“src”) is undefined

 $(document).ready(function () {
     $('#sortdivlink').click(function () {

        var x = $("img[src$='../Images/Sort_down.png'][name='stCodeDSC']");

        if (x.attr("SRC") == "../Images/Sort_down.png") {
            x.attr('src', x.attr('src').replace("../Images/Sort_down.png", "../Images/sort_up.png"));
        }
        else {
             x.attr('src',  x.attr('src').replace("../Images/sort_up.png", "../Images/Sort_down.png"));
        }
    });
});
  • 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-01T19:59:22+00:00Added an answer on June 1, 2026 at 7:59 pm

    you could use a <div> with a css class with a background-image and dimensions, and use $(div).toggleClass(“new-image”) to use the updated background-image

    that will greatly simplify your code.

    [EDIT]

     <html>
        <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
        <style>
        .first-image
        {
           background-image: url( 'http://www.google.com/press/zeitgeist2001/google_logo.gif' );
           width:218px;
           height:90px;
           background-position:center;
           background-repeat:no-repeat;
        }
    
        .second-image
        {
           background-image: url( 'http://www.google.com/doodle4google/2008/images/regional_doodles/CO-80106-16a267f8-3.jpg' );
           width:350px;
           height:224px;
           background-position:center;
           background-repeat:no-repeat;
        }
        </style>
    
        <script>
        $(document).ready(function( ) 
        { 
            $("#target-div").click( function( ) 
            {  
               $("#target-div").toggleClass("second-image");
            });
        });
        </script>
        </head>
        <body>
        <div id="target-div" class="first-image"></div>
        </body>
        </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my JQuery Code: $(function () { $('[id*=clickbtn]').click(function () { var url =
I am desining a Chrome, FF and Safari extension. I wnt someone to be
I have one pdf in my application and I want to open that pdf
I am using Ant script to generate javadoc and I just only wnt Ant
In iPhone App on click of table view cell I want to display Table
I have a web page and a modal dialog page. On clicking the save
i have this include function in a file inside another folder called ajax, but
i have this jquery function that i want to pass topic parameter to, i
Greeting !! i wnt to know more about abstact class and Interface . and
I want to create a asp.net button control / link button control when user

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.