Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting a jQuery 'ui.element is undefined' error?

I have the following:

$('#widgets ul').sortable(
{
  connectWith: ['#widgets ul'],
  opacity: 0.7,
  start: function(e, ui) {
    fromWidgetPosition = ui.item.prevAll().length + 1;
    fromRowId = ui.element.attr('id');

I just upgraded jQuery from 1.2.6 to 1.3.2, and I also upgraded the jQuery UI library to the latest version.

like image 297
Chad Johnson Avatar asked Oct 15 '22 13:10

Chad Johnson


1 Answers

The 'element' got removed in newer jQuery UI versions, see this bug report and the corresponding source changeset.

According to those, you should use $(this) instead:

fromRowId = $(this).attr('id');
like image 139
Henrik Opel Avatar answered Oct 20 '22 17:10

Henrik Opel