load html via get and observe click events
hi there!
still have a problem with the following code:
- <ul>
- <li><a class="open-page" href="/somewhere.html">link1</a></li>
- <li><a class="open-page" href="/elsewhere.html">link2</a></li>
- </ul>
- <div id="container"></div>
- $(document).ready(function() {
- $('.open-page').click(function(e) {
- var url = $(this).attr('href');
- $.get(url, function(data) {
- $('#container').html(data);
- });
- return false;
- });
- });
i want to load HTML called by a click on an open-page element into the given container <div id="#container">
well, that works fine but does not for elements loaded into the div also
having a open-page class.
i also tried to use .live() - nothing. the links where opened by the
common way browser handle this anchors - follow the link ;)
how to handle these added elements?
thank you!