JavaScript Retrieving ID parameter from URL in javascript

I am looking for a little help in trying to retrieve the ID from an URL using JavaScript. I have a main menu system which looks like this

<section id="menu">
 <ul id="main">
  <li id="first"><a target='_blank' href="index.html">Home</a></li>
  <li><a target='_blank' href="Tables.html">League Tables</a><span class="darrow">&#9660;</span>
  <ul class="sub1">
    <li><a target='_blank' href="Tables.html?id=DivP">Premier Division</a></li>
    <li><a target='_blank' href="Tables.html?id=Div1">Division 1</a></li>
    <li><a target='_blank' href="Tables.html?id=Div2A">Division 2A</a></li>
    <li><a target='_blank' href="Tables.html?id=Div2B">Division 2B</a></li>
    <li><a target='_blank' href="Tables.html?id=Div2C">Division 2C</a></li>
    <li><a target='_blank' href="Tables.html?id=Div2D">Division 2D</a></li>
  </ul>
  </li>
 <li><a target='_blank' href="Fixtures.html">Fixtures/Results</a></li>                  
 <li><a target='_blank' href="ClubContacts.html">Club Contacts</a></li>
 <li><a target='_blank' href="TalkinBaws.html">Talkin' Baws</a></li>
 <li><a target='_blank' href="ContactUs.html">Contact Us</a></li>
</ul>
</section>

In the tables page I already have some JavaScript(code added at the end) running using the document.ready() which hides all the divisions from 1 - 2D and displays only the premier. When on the tables page i have added a second menu list which shows and hides the divisions based on the users selection using IDs and the .hide()/.show() from JavaScript

<ul>
 <li><a target='_blank' href="#" id='showDivP'>Premier Division</a></li>
 <li><a target='_blank' href="#" id='showDiv1'>Division 1</a></li>
 <li><a target='_blank' href="#" id='showDiv2A'>Division 2A</a></li>
 <li><a target='_blank' href="#" id='showDiv2B'>Division 2B</a></li>
 <li><a target='_blank' href="#" id='showDiv2C'>Division 2C</a></li>
 <li><a target='_blank' href="#" id='showDiv2D'>Division 2D</a></li>
</ul>

This list is working using the .click(), however the problem I am having is that I want the page to load the desired division depending on the selection made from the main menu.

For example, if the user is on the home page and tries to go directly to Division 2B through the main menu and I am wondering how I can get the ID from the anchor tag in the URL (a target='_blank' href="Tables.html?id=Div2B") in order to display the correct division when the page is loaded.

This is the JavaScript I have already:

$("document").ready(function()
{

$('#DivP').show();
$('#Div1').hide();
$('#Div2A').hide();
$('#Div2B').hide();
$('#Div2C').hide();
$('#Div2D').hide();

$('#showDivP').click(function()
{
    $('#DivP').show();
    $('#Div1').hide();
    $('#Div2A').hide();
    $('#Div2B').hide();
    $('#Div2C').hide();
    $('#Div2D').hide();
});

$('#showDiv1').click(function()
{
    $('#DivP').hide();
    $('#Div1').show();
    $('#Div2A').hide();
    $('#Div2B').hide();
    $('#Div2C').hide();
    $('#Div2D').hide();
});
$('#showDiv2A').click(function()
{
    $('#DivP').hide();
    $('#Div1').hide();
    $('#Div2A').show();
    $('#Div2B').hide();
    $('#Div2C').hide();
    $('#Div2D').hide();
});
$('#showDiv2B').click(function()
{
    $('#DivP').hide();
    $('#Div1').hide();
    $('#Div2A').hide();
    $('#Div2B').show();
    $('#Div2C').hide();
    $('#Div2D').hide();
});
$('#showDiv2C').click(function()
{
    $('#DivP').hide();
    $('#Div1').hide();
    $('#Div2A').hide();
    $('#Div2B').hide();
    $('#Div2C').show();
    $('#Div2D').hide();
});
$('#showDiv2D').click(function()
{
    $('#DivP').hide();
    $('#Div1').hide();
    $('#Div2A').hide();
    $('#Div2B').hide();
    $('#Div2C').hide();
    $('#Div2D').show();
});


}); 

My apologies if this is seen a duplicate question but I am yet to find a definitive answer that I can understand and work with.

Thanks for any help

Answer:1

I have an element with ng-class attribute like this: <label class="item item-input item-floating-label" ng-class="{'has-errors':{{loginForm.$submitted && loginForm['...

I have an element with ng-class attribute like this: <label class="item item-input item-floating-label" ng-class="{'has-errors':{{loginForm.$submitted && loginForm['...

  1. ngclass expressionchangedafterithasbeencheckederror
  2. ngclass expression example
  3. ngclass expression angular 6
  4. ngclass expression angular 7
  5. ngclass expression angular 2
  6. ng class with expression angular 4
  7. ng class expression if
  8. angularjs ng class expression
  9. ngclass expression array
  10. ng-class expression in angularjs
  11. ng-class expression conditional
  12. ng-class expression ternary
  13. ng-class expression multiple
  14. ng-class expression not working
  15. ng-class expression if else
  16. ng-class expression concatenate
  17. ng-class expression function
  18. ng-class expression not updating
  19. ng-class expression angular
  20. ng-class expression syntax

Setting width for <li> tags not working. Width is changing based on content for <li> tag below is the html code Without using display: block/table/inline-block; <!DOCTYPE ...

Setting width for <li> tags not working. Width is changing based on content for <li> tag below is the html code Without using display: block/table/inline-block; <!DOCTYPE ...

  1. javascript setting width of element
  2. javascript setting width

<li ng-repeat="appliance in appliances | limitTo:2"> <div class="icon"> <img src="images/vector/Appliances/w-{{appliance.DashboardIcon}}.svg"> </div> <div ...

<li ng-repeat="appliance in appliances | limitTo:2"> <div class="icon"> <img src="images/vector/Appliances/w-{{appliance.DashboardIcon}}.svg"> </div> <div ...

I searched the internet for answer but when I couldn't find one, I am posting my question. Is there any way we can detect if a site is being used by computer or mobile? I don't want to use the ...

I searched the internet for answer but when I couldn't find one, I am posting my question. Is there any way we can detect if a site is being used by computer or mobile? I don't want to use the ...