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
Post a Comment