Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8387731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:17:40+00:00 2026-06-09T18:17:40+00:00

Desired effect: rows (tr) with class do-not-sort excluded from containment using jQuery.sortable. Current code:

  • 0

Desired effect: rows (tr) with class do-not-sort excluded from containment using jQuery.sortable.

Current code:
(containment: ‘parent’/containment: ‘.sortable-body’)

<table>
    <thead>
        <tr>
            <th>Field 1</th>
            <th>Field 2</th>
        </tr>
    </thead>
    <tbody class="sortable-body">
        <tr>
            <td>Sortable Field 1</td>
            <td>Sortable Field 2</td>
        </tr>
        <tr>
            <td>Sortable Field 1</td>
            <td>Sortable Field 2</td>
        </tr>
        <tr class="do-not-sort">
            <td colspan="2"><a href="#">Add Row</a></td>
        </tr>
    </tbody>
</table>

How can I exclude the ‘do-not-sort’ row at the end (!) of a tbody from the containment? The following didn’t work:

containment: ‘.sortable-body tr:not(.menu-rij-toevoegen)’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:17:42+00:00Added an answer on June 9, 2026 at 6:17 pm

    You can identify which items are sortable with the 'items' parameter — the value should be specified as a CSS selector.

    So to provide negative criteria (exclude elements from the group), use the :not() pseudo-class, like this:

    $('.sortable-body').sortable({ items: 'tr:not(.do-not-sort)' })​;​
    

    And it works here, with your precise markup: http://jsfiddle.net/MUEuW/2/

    Update: probably your best way of excluding the last row from containment is to simply wrap it in a separate <tbody> tag.

    Multiple <tbody>s are legal. See: Can we have multiple <tbody> in same <table>?

    Updated fiddle here: http://jsfiddle.net/MUEuW/3/

    … or do you not have control over the HTML?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I not getting the desired effect from a script. I want the password to
I found this code to achieve the desired effect and tried it on JSFiddle
I can't seem to get the correct combination to get the desired effect: Current
The desired effect is working in Firefox and Chrome, but not Safari. The Animation
Consider the following HTML snippet. The desired effect is to have a dropdown be
Problem in MATLAB Code for solving desired 'n' number of simultaneous equations of the
I have body { background: url(images/background.svg); } The desired effect is that this background
Wondering if anyone knows how to achieve a typewriter effect with the jQuery Cycle
I'm having some trouble achieving my desired effect in an OpenGL ES app I'm
I've a fairly simple little cs4 project where my desired effect is a clock

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.