load dynamic pages into div

Out of context: Reply #2

  • Started
  • Last post
  • 4 Responses
  • dbloc0

    found this....

    <ul>
    <li><a href="page1.html" class="dynamicLoad"></a></li>
    <li><a href="page2.html" class="dynamicLoad"></a></li>
    <li><a href="page3.html" class="dynamicLoad"></a></li>
    </ul>

    <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

    $( '#myDiv' ).load( $( this ).attr( 'href' ) );
    });
    });
    </script>

View thread