Hi following is my code Snippet. What i am trying to do is that i want to find img
within the image_div
and attach draggable
event to it.
$(function() {
jQuery('#image_div').each({
$(this).find('img').draggable({revert: true});)};
});
Above Code Throws me following error
SyntaxError: missing : after property id//$(this).find('img').draggable({revert: true});
you're overcomplicating it..
Here is your updated fiddle.. http://jsfiddle.net/jFIT/FCjr5/1/
Selectors in JQuery always return an array of objects. you do not need to use a loop to iterate through them to create events for each one.. for example, 5 buttons with the same class "buttonClass" have the same click event: $('.buttonClass').click(function () { ..... });