The simplist jQuery menu to select the html for an empty div
I have a with about six <li>
's ... I want each to be a menu choice, you know, as usual with a link color 开发者_运维问答and a hover color. Any selected #ThisStory
clicked loads ThisStory.html into an empty division called #storyDiv
.. Upon making another selection, html of the new id overwrites the previous content of #storyDiv
.
I know this is basic, but I seem to be lower than basic..
I've seen something like this done by wrapping each menu item with a , I think, and giving the span an id?? or some such...
Must it be done so round about? Can't each element <li>
directly be given an id?
Many thanks in advance!!
Try something similar to:
$('ul#myMenueId li a').bind('click', function(){
$('#myTargetDiv').load($(this).attr('href'));
return false;
}
The function must return false to prevent the browser from loading it into the parent window.
精彩评论