Hello, I have this:
<div id="inner">
some text <a href="#contacts">link1</a>
</div>
<a href="http://anotherlink.com">link2</a>
And JQuery code:
$('#inner a').click(function(){
console.log( 'achtung' );
});
But when I click at link1, click-handler doesn't call.
And in another situation:
$('a').click(function(){
console.log( 'achtung' );
});
And when I click at link2, handler calls, but link1 is still unworking.
Could you explain me: why?
Here is more code:
<div id="text-wrapper">
<div id="text">
<div id="content_close">close</div>
<div id="inner">
<!--Here will be content--> <br />
</div>
...
</div>
And content is loaded by ajax into inner-block.
My problem was in that I'm loading content with links dynamically, so, when jquery code runs, the page could doesn't content my link. So I have to use live-function:
$('#inner a').live( 'click', function(){ alert('achtung'); } );
Thanks all, problem is solved.