HTML
<ul id="sortlist">
<li class='ui-state-default' id='listfield_1'>t1 <span class="remove-button"></span></li>
<li class='ui-state-default' id='listfield_2'>t2 <span class="remove-button"></span></li>
<li class='ui-state-default' id='listfield_3'>t3 <span class="remove-button"></span></li>
</ul>
jQuery
<script>
$(function() {
$('.remove-button').on('click',function(){
$(this).parent().remove();//刪除
});
});
</script>
CSS
.remove-button {
background-image: url('delete_icon.png');
}
.remove-button {
background-repeat: no-repeat;
padding: 0px 4px;
width: 20px;
height: 20px;
float: right;
margin-right: 5px;
cursor: pointer;
}
全站熱搜
留言列表