jquery event not registering -


I have an image in which I have one click event, which is fine if I go

 $ ('# Image-id') Click (function () {warning ('click');});  

My problem is that if I go

 $ MyGlobals = {ID: $ ('# image-id')}; Var mg = $ Meglobles; Mg.id.click (function () {alert ('clicked';)};  

The second method does not work at all, but if I try to get an attribute, then mg .id.attr ('title'); This gives fine, its only events that do not work.

Perhaps you've added a button after the document has been loaded. You can try to use live instead.

 mg.id.live ('click', function () {warning ('click');});   

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -