0

Hi all I am trying to add a class selected to click area and a remove class in the hide area for the below jquery/javascript. Not really undstanding how it's added.

Thanks in advaance

D

  <script type="text/javascript">
        $(document).ready(function(){
            $('.partner_image').click(function() {
               var id =$(this).class('selected');
               var id = $(this).attr('id');
               id = id.replace('partner_','');
               console.log(id);

              $('.partner_description').hide();
              var description = $('#partner_description_' + id);
              $(description).show();
                });

            });

        </script>
2
Contributors
3
Replies
24
Views
4 Years
Discussion Span
Last Post by EvolutionFallen
0

Hi EvolutionFallen thanks for the reply I have added the elements in bold don't seem to work yet am I on the correct track.

Thanks in advance

D

 <script type="text/javascript">
        $(document).ready(function(){
            $('.partner_image').click(function() {
               var id = $(this).attr('id');
               id = id.replace('partner_','');
              ** $(this).addClass("selected"); **
               console.log(id);

             $('.partner_description').hide();
              var description = $('#partner_description_' + id);
             ** $(this).removeClass("selected"); **
              $(description).show();
                });
            });
        </script>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.