Jquery Selecting Multiple Classes, Loading External Files
- by WillingLearner
I have 2 links, with the class dynamicLoad.
<ul class="navbar">
<li><a href="Page3-News.html" class="dynamicLoad news">NEWS</a></li>
<li><a href="Page2-Events.html" class="dynamicLoad">EVENTS</a></li>
</ul>
and then I have this already working code, which loads external pages into a div named #MainWrapper:
<script type="text/javascript">
$( document ).ready( function() {
$( 'a.dynamicLoad' ).click( function( e ) {
e.preventDefault(); // prevent the browser from following the link
e.stopPropagation(); // prevent the browser from following the link
$( '#MainWrapper' ).load( $( this ).attr( 'href' ) );
});
});
</script>
How do I edit this code and my links, so that i can target the 1st link with the classes of both dynamicLoad and news, and then, load another script and/or pages into the main wrapper, without breaking its already working functionality?