views:

143

answers:

1

Hello, Can anyone figure out why this gives me blank alert boxes in ie7?

$("#bottles a").livequery("click", function(event) {  
 thetitle=$(this).attr("title");  
 alert(thetitle);  
 return false;  
});

For each new A tag loaded, ie7 alerts a blank message (FF correctly shows the respective titles) However, when thetitle= $(this).html(), ie7 alerts the correct information. Am I missing something here?

A: 

The jQuery selector and accessor are overkill for that. Have you tried this?

$("#bottles a").livequery("click", function(event) {  
        // Always define a local variable, unless you explicitly 
        //  want your variable to be globally scoped.
        var thetitle = this.title;  

        alert(thetitle);

        return false;  
});

On a separate note, did you know that jQuery 1.3.x has LiveQuery built in? No need for the additional plugin anymore.

Dave Ward