JQuery .load() inside div

后端 未结 3 1292
长情又很酷
长情又很酷 2021-01-06 16:19

This has been driving me nuts! I\'ve searched and tried a bunch of suggestions that seem like they should work, so I must be doing something foolish.

$(docum         


        
3条回答
  •  無奈伤痛
    2021-01-06 16:38

    This is the correct code:

    $(document).ready( function(){
      $('.trigger').click(function(){
          var link = $(this).attr("href");
          $('#target').load( link + ' body' );
          return false;
      });
    });
    

    and it's better to have a basic html structure in target files like this:

    
      
        Content
      
    
    

提交回复
热议问题