I'm trying to switch which paragraph is showing with this snippet, by finding the specific paragraph id and switching it's class. But somehow the classes aren't switching. I suspect syntax issues, but I don't know what I'm missing.

<script>
$(document).ready(function(){

    $('#residence_features,#the_kitchens,#master_bath,#guest_powder,#bathrooms,#notes').click(function(){
    $('.feature_subnav').removeClass('features_selected'); // side nav
    $('.feature_paragraphs').removeClass('graph_selected'); // first remove all selected graphs

        var selected_li =  $(this).attr('id');
        var setgraph = "'.feature_"+selected_li+"'";
        // the p id I'm trying to get would be "feature_li_id" for example
        alert(setgraph);

        $(this).addClass('features_selected');
        $(setgraph).addClass('graph_selected');


    });
});
</script>

Do you have this site online so we can see the HTML code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.