jquery ui sortable append -


here jquery code stands.

$(document).ready(function() { $('#btn1').click(function() {    $("ol").append("<li>"+$("#txt1").val()+"</li>");    $("#txt1").val("").focus();    $('li').addclass('block2');    $('li').click(function() {      $(this).hide(500, function() {      $(this).remove('li');    });  }); }); }); 

its blank todo list, when enter in text , click button, appends list. i'm looking code re-arrange items in list 'that have been appended'. examples jquery-ui sort-able or drop-able, have 'li' elements in place in html not work in code.

how add jquery code make user entered list rearrangable?

you can recalling sortable() inside first .click(), so:

$(document).ready(function() {     $('#btn1').click(function() {         $("ol").append("<li>"+$("#txt1").val()+"</li>");         $("#txt1").val("").focus();         $('li').addclass('block2');         $('ol').sortable();         $('li').click(function() {             $(this).hide(500, function() {             $(this).remove('li');         });     }); }); 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -