<script> <br>$.schoolFn = { <br>addItem: function(obj){ <br>$("#itemList").append("<li id='liItrm' class='list-group-item clearfix'><span class='glyphicon glyphicon-resize-vertical sort-handle'></span>" obj "<input type='hidden' name='audiences' value='" obj "'><button type='button' class='close delete-btn deleteItem' onclick='deleteItem(this);' title='删除'>×</button></li>"); <br>}, <br><br>removeItem: function(obj){ <br>$("#" obj).replaceWith(""); <br>} <br>} <br>$("#itemAdd").click(function(){ <br>var item=$('#teacherInput').val(); <br>$.schoolFn.addItem(item); <br>$('#teacherInput').val(""); <br>}); <br>function deleteItem(obj){ <br>var item=$(obj).parents(".list-group-item").attr("id"); <br>$.schoolFn.removeItem(item); <br>} <br></script>