Options to define link HREF
Is there a way to specify a link to say don't navigate. There is an option to specify href="#". But if the link output is directed to a target this will c开发者_开发问答ause the calling page to be loaded in that target.
In a file called load.php I have these links defined for folder nodes in a navigation tree.
<a href="#"> link </a>
The page nodes under the folders have
<a href="page.html">page link</a>
Each link in the navigation tree is directed to a content area.
Here is the problem. If I click on a folder, the href="#" causes the tree page to be loaded in the content area. I want to specify the href to not load anything in the content area for the folders. I have a workaround where I load a blank page. But if there is a different way I would prefer that.
I would do this with JavaScript. Specifically you can load the jQuery library and do something like this:
$("a[href='#']").click(function(event) {
event.preventDefault();
event.stopPropagation();
});
精彩评论