add an attribute at the end of the herf

I have a menu with some herf like this to put some attribute at the end of the url after redirect

<ul>
<li><a href="/buzz#tab_pane_dashboard">By Keyword</a></li>
<li><a href="/buzz#table_profile_fbpage">By FB Page</a></li>
<li><a href="/buzz#tab_pane_fbevent">By FB Event</a></li>
</ul>

Then i tried to get the path value

  var path = window.location.pathname.split('#');
        var attribute = path[1];
        console.log(path);
<!----and do something!---->

But it returens an error :

jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: .sa-tabs a[href=#tab_pane_dashboard]

so how may i solve it?

P.S: i am using easytab in somewhere else in my project.

Answers 1

  •   var x = location.hash;
        var valid = x;
    
        if(valid =="#test"){
         //do something
        }
        else{
         //else do something
        }
    

    basically i used something like this to solve my problem


Related Articles