so my problem is here:
http://jsfiddle.net/hskhu/
When i click “Rejestracja” Link, it changes content of div, but after this when i try to click “logowanie” link nothing matters, i dont know why can someone help me? all divs with contents of Rejestracja and logowanie are under html with display:none atribute
JS here:
<script>
$(document).ready(function(){
$('#change').click(function(){
var $which = $(this).html();
var $wyjmij = $('#' + $which).html();
$('#loginbox').html($wyjmij);
});
});
</script>
You are binding an event to the element with the id
#change. You are replacing the element when the link is clicked, meaning the current bound event has no valid target.You need to bind the event to a closer static element and delegate the event to the
#change.You can do this using
on().Check the section on
Direct and delegated eventsin the on() documentation.Change your code to the following:
DEMO – Using dynamic bindings by binding to
#loginboxtargeting#change