I'm trying to select a particular tab section of a web page, on clicking a link on another page. I was suggested to use the location.hash function to select that particular anchor element of the tab and add the hash property in the href attribute of the first web page.
But the code doesn't work for me.I get the entire page,instead of the particular tab selected. Can some one help me out?
Here is the code. This is the link in the first web page. I want the Submitted tab of the second webpage to be selected. So I have added the id of that tab, #submitted to the url.
<a id="formStatus<?php echo $status;?>" class="code_link" href="/FormBuilder/main/viewAllMyForms#submitted"><?php echo $status;?></a>
This is the code of the second page,where I check if location.hash equals submitted.
if(location.hash=="submitted") {
$("#submitted").trigger("click");
}
$('#submitted , #formStatusSubmitted').click({
<?php foreach($myForms as $form):
if($form['Form']['status']=="Incompleted"){ ?>
$('.fm_myformsample_container'+<?php echo $form['Form']['id'];?>).hide();
<?php }
else{?>
$('.fm_myformsample_container'+<?php echo $form['Form']['id'];?>).show();
<?php }
endforeach;?>
$('#sort_by').find(".selected").removeClass();
$('#submitted').addClass("selected");
});