I am trying to get the href value after I click on it, so I can use then the <?php include 'list'; ?> to load the content of the php page I’d clicked before. I was trying something like this:
$(document).ready(function() {
$('list').click(function)
var page=$(href);
<ul id="list">
<li><a href="mypage.php">Mypage</a> </li>
<li><a href="mypage2.php">Mypage2</a> </li>
So I can load a paragraph in my page using the content of the link I clicked before?
You can get the href value, then load the content of the linked page using the proper selectors and any appropriate jQuery ajax function, like ajax() or load().
The code was missing the hash telling jQuery to find the id ‘list’. The ‘#list > li a’ tells jQuery to apply the code block to all ‘li a’ children of #list.