Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete Jquery-ui sortable list item

Simple question about Jquery-UI sortable lists (http://jqueryui.com/demos/sortable/#default)

I have made:

<ul id="sortable">
<li class="ui-state-default">An item 
<input class="delit" type="submit" value="Delete" />
</li>
</ul>

How can I make each item have a button that deletes the item it is next to? What's the syntax for this?

like image 357
David19801 Avatar asked Jan 10 '12 15:01

David19801


1 Answers

<ul id="sortable">
    <li class="ui-state-default">An item 
        <button class="delete">Delete</button>
    </li>
</ul>

JS:

$("#sortable .delete").click(function() { 
    $(this).parent().remove();
});
like image 175
Andreas Eriksson Avatar answered Nov 08 '22 06:11

Andreas Eriksson