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

The Archive Base Latest Questions

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

My html code is <div id=starimg> <a href=# class=imgstar onclick=ratingFunc()><img src=images/star1.png class=star /></a> <a

  • 0

My html code is

<div id="starimg">
  <a href="#" class="imgstar" onclick="ratingFunc()"><img src="images/star1.png" class="star" /></a>
  <a href="#" class="imgstar" onclick="ratingFunc()"><img src="images/star1.png" class="star" /></a>
  <a href="#" class="imgstar" onclick="ratingFunc()"><img src="images/star1.png" class="star"/></a>
  <a href="#" class="imgdarkstar" onclick="ratingApp()"><img src="images/star2.png" class="star1"/></a>
  <a href="#" class="imgdarkstar" onclick="ratingApp()"><img src="images/star2.png" class="star1" /</a>  
</div>

my java script code is

function ratingFunc(){
    if( $('.star').attr("src")=='images/star1.png'){
        $(this).replaceWith("<img src='images/star2.png' class="star1"/>");
        starcheck=true;
    }
    else{
        $(this).replaceWith("<img src='images/star1.png' class="star"/>");
        starcheck=false;
    }
}

function ratingApp(){
    if($('.star1').attr("src")=='images/star2.png'){
        $(this).replaceWith("<img src='images/star1.png' class="star"/>");
        starcheck=true;
    }
    else{
        $(this).replaceWith("<img src='images/star2.png' class"star1"/>");
        starcheck=false;
    }
}

when i am clicking on image then these function are not working..please help me.
Thanks in advance.

  • 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-10T12:01:27+00:00Added an answer on June 10, 2026 at 12:01 pm

    Your function doesn’t know what does this $(this) mean within.
    It does, but thats not what you are looking for 🙂

    Replace $(this) with $(".star") in first function and
    Replace $(this) with $(".star1") in other function.

    and it will work fine.

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

Sidebar

Related Questions

HTML code: <div id=img-wrapper> <img src=images/1.png title=Picture 1 class=my-img /> <img src=images/2.png title=Picture 2
I have the following HTML code inside a div: <a href=http://www.mysql.com> <img src=images/php-power-micro2.png alt=Image
HTML code: <div class=goleft> AD 300x250 size </div> <div class=itemImageBlock goleft> <span class=itemImage> <img
HTML code <div class='case'> <a href=http://localhost/DXXX/case/reqirement.doc rel=case> view</a> </div> Jquery code $(.case).live('click', function(){ $.fancybox({
Have a look at this HTML code: <div class=overlay> <a href=#>1</a> <a href=#>1</a> <a
This is the HTML code: <div class=test onclick=$(this).vote('<$>votehash</$>', null, event)></div> I am currently using
I use this html code <div class=titleIn> <h2><a href=/link2>link2</a></h2> </div> and for some reason
HTML code: <div class=clearfix style=color: #555 style=display:block; > <input type=text id=id_site placeholder=nom-du-site style=width: 245px;
my html code <div id=content_main></div> css #content_main { width:1024px; height:150px; background:url('../images/Orange.jpg'); background-repeat:no-repeat; background-size:1024px 150px;
My html code is: <div title=test class=xyz>Tesing</div> I want it to look like: <a

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.