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

☆樱花仙子☆ 提交于 2019-12-10 14:53:51

问题


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.


回答1:


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');


来源:https://stackoverflow.com/questions/1505507/why-am-i-getting-a-jquery-ui-element-is-undefined-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!