2
<ul>
    <a href="#Project">
        <li onclick="project()">Projects</li>
    </a>
</ul>

a tab appears and you can click on it, which runs a javascript function and also changes the url to www.demo.com#Project.

Is it possible when i give someone the link like www.demo.com#Project it loads the page and automatically runs function project()

EDIT SOLUTION

if(window.location.hash == "#Project") {
        setTimeout('project();', 1);
} 
else {
}

a timeout must be set so it loads the page first then execute function

Bamuel
  • 55
  • 8
  • @PraveenKumar I fixed up the example code – Bamuel Dec 02 '16 at 06:44
  • Still the same. Read my comment correctly. – Praveen Kumar Purushothaman Dec 02 '16 at 06:45
  • You can do this `
  • ` but not `
  • `. Check [this](http://stackoverflow.com/questions/8236522/a-clickable-li-using-an-a-tag-no-js-to-be-used-is-it-legal-html) – StackUseR Dec 02 '16 at 06:49
  • Are you going to have multiple links like this, with an anchor and a corresponding JS function? – Shaggy Dec 02 '16 at 07:12
  • @Shaggy yes I have multiple links – Bamuel Dec 02 '16 at 07:14