I have an issue in IE6/7 where they ignore the live binding of elements. I can't seem to find any solutions to this issue, and I really need both IE6 and 7 support (fixing one should fix the other anyway). The first click of my elements works as intended but afterwords the binding goes away and I can't get it to work. This does not happen in IE8 or any other current browsers.
Here's my code. As you can see, on line 5 I am alerting the hrefID variable. After the first click hrefID clearly shows me that the binding disappears as it prints an href that's totally different.
Can anyone help?
// AJAX Page Changing
$("#mContainer a:lt(6),#home a").live("click", function(){
var clickID = 0;
var hrefID = $(this).attr("href");
alert(hrefID);
switch(hrefID){
case 'home':
clickID = 0;
break;
case 'portfolio':
clickID = 1;
break;
case 'resume':
clickID = 2;
break;
case 'about':
clickID = 3;
break;
case 'contact':
clickID = 4;
break;
case 'tutorials':
clickID = 5;
break;
}
$.ajax({
type: 'POST',
url: "/includes/pages/"+hrefID+".php",
data: "ajaxtab=1",
cache: false,
success: function(code){
// Change Tab Image
var expireDate = new Date(new Date().getTime()+86400000*5); //5 Days
document.cookie = "soluml="+hrefID+";expires="+expireDate.toGMTString();
$("#body").fadeTo("fast", 0, function(){$("#body").html(code);});
$("#body").fadeTo("fast", 1);
$.post("/includes/topnav.php",{ajaxtab:clickID},function(data){$("#mContainer").html(data)});
},
error: function(){
return true;
}
});
return false;
});
//