Home>Article>Web Front-end> How to remove li in javascript

How to remove li in javascript

藏色散人
藏色散人 Original
2021-07-17 14:32:34 2815browse

Javascript method to remove li: First create an HTML sample file; then create the li tag content; finally pass "op[i].onclick = function () {oList[i].remove().. .}" method can delete one line of content of the li tag.

How to remove li in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, DELL G3 computer

How to remove li from javascript?

Native Js implementation to delete a line of content in the li tag

##Use object-oriented Idea completes the buyer information deletion function. Each piece of information includes:

Name (name)

Gender (sex)
Phone number (number)
Province (province)

How to remove li in javascript

Achieve the following requirements:

You cannot borrow any third-party libraries and need to use native code to implement them.

Combined with the basic code structure given, add the code in the two code here below to complete the deletion function of buyer information. Note that this page must be clearly displayed on the mobile phone.
The js code can be adjusted arbitrarily, for example, it can be completed using es6 code.

Completed code:

     demo 

序号

姓名

性别

电话号码

省份

操作

  • 1

    张三

    13788888888

    浙江

    删除

  • 2

    李四

    13788887777

    四川

    删除

  • 3

    王二

    13788889999

    广东

    删除

Recommended study: "

javascript Advanced Tutorial"

The above is the detailed content of How to remove li in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn