Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
jquery add remove class onclick link using asp.net C#

Was this review helpful?  Yes  No

    </div>


    $("p").click(function()
    {
        $("p").parent().removeClass("selected");

        $(this).parent().addClass("selected");
    });
Posted
Comments
Member 10918596 24-Feb-15 1:56am    
my query not working properly
stibee 24-Feb-15 2:05am    
What does not work?
http://api.jquery.com/addclass/
Member 10918596 24-Feb-15 2:07am    
when i click yes,color only change yes and when i click No,color only change No.then not select two same time

Instead of Click event.. you can use toggle event to select or deselect yes/No..
 
Share this answer
 
Comments
Member 10918596 24-Feb-15 2:38am    
can you give one example
You can try this code..
JavaScript
$("p").toggle(function()
{
     $(this).parent().addClass("selected");
     }
,function(){
     $("this").parent().removeClass("selected");
})

If this solves your issue kindly up vote and mark this as solution.. Thanks..
 
Share this answer
 
v2
XML
<script type="text/javascript">
     jQuery(function ($) {
         $("a[disabled]").live("click", function () {
             e.preventDefault();
         });
         $(".review-feedbackLink").live("click", function () {
             $(this).addClass("selected");
             $(".review-feedbackLink").attr("disabled", "disabled");
             $(this).parent().after("<span class='thanks'> Thanks for your vote! </span>")
         });
     })
        </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900