Having issues trying to select html injected into the DOM using jquery's load. Works if ul#links content isn't replaced, otherwise it fails to load into #content.
JS
$(document).ready(function() {
// Load links into tab
$("ul#tabs li a").click(function(){
urlTabs = $(this).attr("href");
console.log(urlTabs);
$("ul#links").load(urlTabs);
return false;
});
// Load content
$("ul#links li a").click(function(){
urlLinks = $(this).attr("href");
console.log(urlLinks);
$("#content").load(urlLinks);
return false;
});
});
HTML
<ul id="tabs">
<li><a href="/tab1">Tab 1 </a></li>
<li><a href="/tab2">Tab 2</a></li>
</ul>
<ul id="links">
<li><a href="/link1">This will load into #div, the others will not</a></li>
</ul>
<div id="content">
<p>Load content in here</p>
</div>
New to js in general, any help appreciated.