Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Sortable: group</title>
  <!-- Sortable.js -->
  <script src="http://rubaxa.github.io/Sortable/Sortable.js"></script>
  
</head>
<body>
  
  <ul id="users">
    <li>
      <b>Оля</b>
      <u class="js-remove">x</u>
      <u class="js-edit">edit</u>
    </li>
    <li>
      <b>Владимир</b>
      <u class="js-remove">x</u>
      <u class="js-edit">edit</u>
    </li>
    <li>
      <b>Алина</b>
      <u class="js-remove">x</u>
      <u class="js-edit">edit</u>
    </li>
    <li>
      <b>Степан</b>
      <u class="js-remove">x</u>
      <u class="js-edit">edit</u>
    </li>
  </ul>
  
</body>
</html>
 
ul {
  list-style: none;
  padding: 0;
}
li {
  background: #eee;
  margin: 1px;
  padding: 10px 15px;
  cursor: move;
  border-radius: 5px;
}
.sortable-ghost {
  opacity: .3;
  background: #f60;
}
u {
  float: right;
  cursor: pointer;
  margin-left: 10px;
}
 
Sortable.create(users, {
  // Задаем фильтр
  filter: '.js-edit, .js-remove',
  
  // Обработка фильтра
  onFilter: function (evt) {
    var ctrl = evt.target;
    
    // Проверяем элемент, на который нажали
    if (Sortable.utils.is(ctrl, '.js-remove')) {
      evt.from.removeChild(evt.item);
    }
    else {
      var el = evt.item.firstElementChild,
          name = el.innerHTML;
      
      el.innerHTML = prompt("Имя:", name);
    }
  }
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
RubaXapro
0viewers