i am getting an awkward problem on my javascript, basically i have written the following javascript to remove dynamically added li tabs in my page, but it is not processing, the javascript is:
$(document).ready(function(e)
{
$(".close").on("click", this, function()
{
$(this).closest("li").remove();
var panelId = $(this).closest('li').attr('href');
// $(this).closest('#content').remove();
// $('#tab1').remove();
$('#nav-tabs a:last').tab('show');
$('#close1').on('click',this, function()
{
$('.tab1').remove();
$('#nav-tabs a:last').tab('show');
})
$('#close2').on('click',this, function()
{
$('.tab2').remove();
$('#nav-tabs a:last').tab('show');
})
$('#close3').on('click',this, function()
{
$('.tab3').remove();
$('#nav-tabs a:last').tab('show');
})
})
if(counter <= 1){
counter = 1;
}else {
counter--;
}
return false;
})
});
the problem is when the i/user clicks on .close[button having close class] this javascript does nothing, even though it should remove the closest li tag; moreover, when i paste this in the addition javascript[javascript to add li tags] this starts working!!!