Objects discovered by LiveQuery in ie7

Can anyone understand why this is giving me an empty alert box in ie7?

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

      

For each new loaded tag, i.e. 7 warns a blank message (FF shows the corresponding headers correctly). However, when thetitle = $ (this) .html (), ie7 warns with correct information. Did I miss something?

0


a source to share


1 answer


The jQuery selector and accessor are overkill for this. 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 a built-in LiveQuery ? No need for an additional plugin anymore.

0


a source







All Articles