How to dynamically add and delete elements with jQuery_jquery
<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>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to delete elements but keep child elements in jquery: 1. Use the children() method to get all the child elements of the specified element; 2. Use the unwrap() method to delete the parent element of the child element but keep the child elements. The syntax "$(" specifies the element. ").children().unwrap();".

Methods to delete elements: 1. Use delete() to delete the specified element from the Set object, the syntax is "setObj.delete(value);"; 2. Use clear() to delete all elements in the Set object, the syntax is "setObj.delete(value);" "setObj.clear();".

LinkedList is a general class of JavaCollectionFramework, which implements three interfaces: List, Deque and Queue. It provides the functionality of the LinkedList data structure, a linear data structure in which each element is linked to each other. We can perform a variety of operations on a LinkedList, including adding, removing, and traversing elements. To add elements to the LinkedList collection, we can use various built-in methods such as add(), addFirst(), and addLast(). We will explore how to use these methods to add elements to a LinkedList. in Java

How to delete an element with a specified key name in a PHP array In PHP development, array is a very important data structure. When operating an array, you often encounter situations where you need to delete elements with specified key names. This article will use code examples to introduce how to delete elements with specified key names in PHP arrays. PHP provides a variety of methods to delete elements in an array. Three of the commonly used methods are introduced below. Method 1: Use the unset() function The unset() function can be used to destroy specified variables, including elements in the array.

The array_pop() function in PHP is used to delete the last element of the array. This article will introduce the use of array_pop() function in detail and provide relevant code examples. In PHP, array is a very commonly used data structure used to store multiple related data. Sometimes, we may need to remove an element from the end of an array. At this time, you can use the array_pop() function to complete this operation. The syntax of the array_pop() function is as follows: mixedar

In Python, a linked list is a linear data structure that consists of a sequence of nodes, each node containing a value and a reference to the next node in the linked list. In this article, we will discuss how to add elements to the first and last position of a linked list in Python. LinkedList inPython A linked list is a reference data structure used to store a set of elements. It is similar to an array in a way, but in an array, the data is stored in contiguous memory locations, whereas in a linked list, the data is not subject to this condition. This means that the data is not stored sequentially but in a random manner in memory. Thisraisesonequestionthatis,howwecanac

The problem involves removing elements from either side of a list of integers in such a way that 2*min is greater than max. vector<int>arr={250,10,11,12,19,200};res=solve(arr);We can use brute force method. We can try all possible satisfactions and find the longest subarray that satisfies the 2*min>max condition. We can also use dynamic programming methods to try all possible excessive and unwanted subarray combinations. Example (using vector ADT) Let's say we have an array like "[250,10,11,12,19,200]". To get the best solution we need to remove elements [250,200

Tips and precautions for adding elements to arrays in Java In Java, arrays are a very common and important data structure. It can store a set of elements of the same type, and these elements can be accessed and modified through indexes. In practical applications, we often need to dynamically add elements to an array. This article will introduce some tips and precautions for adding elements to arrays in Java, and provide corresponding code examples. Use dynamic array (ArrayList) to add elements Dynamic array ArrayList is
