问题
I have this code which works however it is using a old legacy function "livequery" which should really be switched to using "on". However for the life of me I can't get this to work. Here is my code snippet.
jQuery('.box').livequery(function(){
jQuery('a', this).click(function() {
return false;
});
jQuery(this).draggable({
appendTo: "body",
helper: 'clone',
opacity: 0.5,
zIndex: 900,
stop: function(event, ui) {
return true;
}
});
});
And I tried this...
jQuery('.box').on('draggable', function(){
jQuery('a', this).click(function() {
return false;
});
jQuery(this).draggable({
appendTo: "body",
helper: 'clone',
opacity: 0.5,
zIndex: 900,
stop: function(event, ui) {
return true;
}
});
});
That didn't work as I am guessing "draggable" isn't the event name...
Thanks..
回答1:
This answer over there New Inserted dom node may help you to convert your code into on functionality instead of live function
来源:https://stackoverflow.com/questions/12332482/jquery-how-to-translate-livequery-to-on