The .click() event is .click() if the menu is outside id="content" (static HTML) but does not work when the menu is inside id="content" (dynamic HTML using .load() ).
Press function:
$(document).ready(function () { $("a.type").click(function () { var type = $(this).data("id"); $('#content').load("content.php?" + type); }); });
Link to the header menu (click event works here):
<li><a data-id="1" class="type">Cars</a></li> <li><a data-id="2" class="type">Houses</a></li>
.load() fills this (click event does not work here):
<div id="content"></div>
source share