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

  • SEARCH
  • Home
  • 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 8523249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:21:22+00:00 2026-06-11T07:21:22+00:00

I’m using jquery sortable with ul and can move the 8 li items below

  • 0

I’m using jquery sortable with ul and can move the 8 li items below around:

enter image description here

I’m want to limit this so only li items that have an img can be sorted (above first 3 items) however I’m finding the following can occurs (eg: can move the 3 images inbetween the non-image li’s):

enter image description here

I am using the following HTML structure (relates to above pic with class unsortable):

<ul id="photoPreviews>
<li class="unsortable">elements</li>
<li class="unsortable">elements</li>
<li>elements</li>
<li class="unsortable">elements</li>
<li>elements</li>
<li class="unsortable">elements</li>
<li>elements</li>
<li class="unsortable">elements</li>
</ul>

Current JQUERY using Cancel:

$('ul#photoPreviews').sortable({
  cancel: 'li.unsortable'    
});

All li elements start with the unsortable class (connected to .sortable() cancel) to start with and this class is removed when an image is added to the li. And I find I can’t sort those items with the unsortable class.

However i can still move the li items with an image inbetween the no image items.

Question: How can I limit it so only li items with an image can be move between each other – so in this example on the first 3 can change places with each other? Is there a way of grouping the sortable items?

thankyou

  • 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-11T07:21:24+00:00Added an answer on June 11, 2026 at 7:21 am

    The ‘items’ option allows you to change which elements are sortable http://jqueryui.com/demos/sortable/#option-items

    Example: http://jsfiddle.net/cjc343/55rzM/

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported

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.