my code is only working once. When I click on the button, the code executes fine. But when I do the same after it executed fine once, it doesn't work, I don't even get the alert('clicked').
Anyone knows why? Here is the code:
$('#eucontentpage #country-choice .item .lang-ico').click(function(){
alert('clicked');
$(this).parent().removeClass('item');
var country = $(this).parent().attr("class");
var language = $(this).html();
var pathArray = window.location.pathname.split( '/' );
var newPathname = "";
for (i = 0; i < 5; i++) {
newPathname += pathArray[i];
newPathname += "/";
}
var loadlink = newPathname + country + "/index_"+ language +".htm #nationalcontentpage";
$.when(
$('.lightbox').after('<div id="insertnationalcontent"></div>')
).done(function() {
$("#insertnationalcontent").load(loadlink),
$('#jb-window').hide(),
$('#jb-window-content').hide(),
$('#jb-overlay').hide(),
$(this).parent().addClass('item'),
$('#insertnationalcontent').fadeIn('slow'),
$.history.load( '' )
});
return false;
});
$(this).parent().removeClass('item');