how to keep same tab highlighting after refreshing the page(page is refreshed after the paging link clicked.)

    <script type="text/javascript">


        /**this is for tab highliting*/
        $(document).ready(function(){
            var str=location.href.toLowerCase();
            $(".navigation li a").each(function() {
                if (str.indexOf(this.href.toLowerCase()) > -1  ) {
                    $("li.highlight").removeClass("highlight");
                    $(this).parent().addClass("highlight");
                }
            });
        })


        /**this is for paging highliting*/
        $(document).ready(function(){
            var str=location.href.toLowerCase();
            $(".paging li a").each(function() {
                if (str.indexOf(this.href.toLowerCase()) > -1  ) {

                    $("li.highlight").removeClass("highlight");
                    // i need codes here to addclass "highlight" previously selected tab after page was refreshed


                    $("li.hp").removeClass("hp");
                    $(this).parent().addClass("hp");
                }
            });
        })




    </script>

thanks..!!

Member Avatar for LastMitch

how to keep same tab highlighting after refreshing the page(page is refreshed after the paging link clicked.)

You can take a look at these links and used a few line of code to add to your own code:

http://stackoverflow.com/questions/4299435/remember-which-tab-was-active-after-refresh

http://stackoverflow.com/questions/10246199/jquery-tabs-make-current-tab-highlighted-from-separate-navigation

http://stackoverflow.com/questions/6857654/jquery-mobile-highlight-a-tab

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.