$(this) in .live("click")-function vs. opera

$(this) in .live("click")-function vs. opera

Hi,

I'm trying to dynamically append DIVs with jQuery that I want to make clickable with jQuery's .live()-function. Appendings DIVs and binding the click works great, but in Opera I get a wierd error when I actually perform the click:

Event thread: click
Error:
name: TypeError
message: Statement on line 167: Type mismatch (usually non-object value supplied where object required)
Backtrace:
Line 167 of linked script http://blogage.local/javascripts/applic ... 1247856519
if(self.hasClass("selected")) {
... Line 2646 of linked script http://blogage.local/javascripts/jquery.js?1235570300
function(){ return fn.apply(this, arguments); }

[backtrace goes on and on here]


The code is simple:

$("#files_to_upload .file_upload").live("click", function() {

  self = $(this);

  if(self.hasClass("selected")) {
    self.removeClass("selected");

    [...]   

  } else {
    self.addClass("selected");
  }
  return false;
});


Thanks for help
Luke