I tried posting this a few minutes ago but it didn't appear - so sorry if this is a dupe. This is a bit of an irregular question, but is it possible to attach an event to a class instantiation? For example: function Person() { /* constructor code */ } var bob = new Person(); // instantiation event fires here My gut feeling is that this isn't possible, but I wanted some input before I dismissed the idea. Thanks!
This is a bit of an irregular question - but is it possible to assign an event to a class instantiation? For example: function Person() { /* constructor code */ } var bob = new Person(); // event gets fired here
When using draggables and droppables, I'm having difficulty understanding how to query the dropped element. For example, right now I can do something like the following: $('.droppable').droppable({ accept: '.draggable', tolerance: 'pointer', drop: function() { $(this).append('hey'); } }); But what I would like to be able to do is like the following: $('.droppable').droppable({ accept: '.draggable', tolerance: 'pointer', drop: function() { $(this).append($(draggableElement).text()); } }); where draggableElement is the element that was dropped. I've seen examples on how to do this in older versions of the library, but I can't seem to get anything to work using jQuery 1.2.3 and UI 1.5b