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
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 loginI 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!
Previous article:jQuery checkbox selection and get value Next article:jquery form validation submissionStatement of this WebsiteThe 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.cnLatest Articles by Author
2018-06-11 11:57:34 2018-06-15 15:55:18 2018-06-15 15:49:00 2018-06-15 15:46:15 2018-06-15 15:42:38 2018-06-15 15:40:34 2018-06-15 15:39:32 2018-06-15 15:37:14 2018-06-15 15:34:21 2018-06-15 15:22:51Latest IssuesSteps to install jQuery in Nuxt.js Although I try to add jQuery in my project, I get an error saying it's not defined. plugin...From 2023-11-06 16:41:5001225I have...From 2023-11-01 23:01:1901209Support jQuery's Transfer-Encoding:chunked I'm a web developer. In my script I use header() to set "Transfer-Encoding:chunked&qu...From 2023-10-25 23:44:3701230Automatically expand text area I'm trying to make a simple auto-expanding text area. This is my code: textarea.onkeyup=fu...From 2023-10-21 08:49:2302225Related TopicsMore>Popular RecommendationsPopular TutorialsMore>
JAVA Beginner's Video Tutorial2357774 Latest DownloadsMore>
- About us Disclaimer Sitemap
- php.cn:Public welfare online PHP training,Help PHP learners grow quickly!