Показать сообщение отдельно
  #6 (permalink)  
Старый 26.12.2016, 18:28
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,070

Infinity178,
<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <title>sortable demo</title>

  <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css">

  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>

  <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

</head>

<body>



<ul id="sortable">

  <li>Item 1</li>

  <li>Item 2</li>

  <li>Item 3</li>

  <li>Item 4</li>

  <li>Item 5</li>

</ul>
<input name="" type="button" value="Ajax" class="btn">


<script>

$("#sortable").sortable();

$(".btn").on('click', function() {
$("<li>", {text: "Item "+ ($("#sortable li").length+1)}).appendTo("#sortable")
$( "#sortable" ).sortable( "refresh" );
}

)

</script>



</body>

</html>
Ответить с цитированием