JQuery operates the position of tr in the table

php中世界最好的语言
Release: 2018-03-15 11:06:01
Original
2935 people have browsed it

This time I bring youJQueryOperation of the position of tr in the table, what are theprecautionsfor JQuery to operate the position of tr in the table, the following is a practical case, let's take a look one time.

TableStyle

Copy after login

js code

// 上移 function moveUp(obj) { var current = $(obj).parent().parent(); //获取当前 var prev = current.prev(); //获取当前前一个元素 if (current.index() > 0) { current.insertBefore(prev); //插入到当前前一个元素前 } } // 下移 function moveDown(obj) { var current = $(obj).parent().parent(); //获取当前 var next = current.next(); //获取当前后面一个元素 if (next) { current.insertAfter(next); //插入到当前后面一个元素后面 } }
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How does the jquery plug-in print the page content

How does the jQuery running page trigger the click event by default

Detailed explanation of tree shape in layui about value passing

The above is the detailed content of JQuery operates the position of tr in the table. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!