javascript - jquery load function get only div instead of whole page -


i apologize if you've seen this. i'm still struggling bit this. need modify function load coltwo div link selected on menu instead of entire page.

i see code jquery website:

$('#result').load('ajax/test.html #container'); 

but don't understand how make function this.

<!doctype html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>my title</title> <link href="default.css" rel="stylesheet" type="text/css" /> </head>  <script type="text/javascript" src ='jquery-1.9.1.min.js'></script> <script type="text/javascript">       $(function(){         $('#menu li a').on('click', function(e){             e.preventdefault();             var page_url=$(this).prop('href');             $('#coltwo').load(page_url);         });     });   </script> <body> <div id="header">     <h1>my title</h1> </div> <div id="content">      <div id="colone">          <div id="menu1">             <ul id="menu">                 <li><a href="members.html">members</a></li>                 <li><a href="about.html">about</a></li>              </ul>         </div>         <div class="margin-news">             <h2>recent updates</h2>             <p><strong>none @ time</strong> </p>         </div>     </div>      <div id="coltwo"><h2>starting text</h2></div>     <div style="clear: both;">&nbsp;</div> </div>  </body> </html> 

kevin b correct:

$('#coltwo').load(page_url + ' #coltwo'); 

just add selector string url, , don't forget space!


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -