首页 > 解决方案 > 在javascript中使用if条件

问题描述

我想if在javascript中使用。我使用了if下面提到的条件。但是是不正确的。为什么错了。我该如何解决?

var fixHelperModified = function(e, tr) {
  var $originals = tr.children();
  var $helper = tr.clone();
  $helper.children().each(function(index) {
    $(this).width($originals.eq(index).width())
  });
  return $helper;
},

if (window.confirm("Do you really want to update the order?")) {
  updateIndex = function(e, ui) {
    $('td.index', ui.item.parent()).each(function(i) {
      $(this).html(i + 1);
    });
  };
}

$("#table tbody").sortable({
  helper: fixHelperModified,
  stop: updateIndex
}).disableSelection();

标签: javascriptjquery

解决方案


您必须删除第','8 行中的内容。


推荐阅读