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 6094675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:42:26+00:00 2026-05-23T12:42:26+00:00

I’m using the Jquery-ui. I have different droppable ul(s) in one page, and different

  • 0

I’m using the Jquery-ui.
I have different droppable ul(s) in one page, and different draggable li(s) too. What I wanted was that:
1. ul differ from each other by their title, like “FUNCTION”, “BUG”, etc.
2. li differ from each other by their class, like “.FUNCTOIN”, “.BUG”, etc.
3. ul with title of “FUNCTION” can only accept li with class “.FUNCTION”, etc.
4. the titles of the ul(s) can only be known while they are being created in the View, according to some values stored in the db.

but then i encuntered some problems, here are the different satuations:

if i use constant value, it works well, like:

        $("ul.droppable").droppable({
            accept: ".FUNCTION",

while all the following ways failed:

        $("ul.droppable").droppable({
            accept: "." + $(this).attr("title"), 

        $("ul.droppable").droppable({
            accept: '.' + $(this).attr("title"), 

        $("ul.droppable").droppable({
            accept: "\." + $(this).attr("title"), 

        $("ul.droppable").droppable({
            accept: '\.' + $(this).attr("title"), 

so i put the “.” in the title and tried the following, but all of them failed:

        $("ul.droppable").droppable({
            accept: $(this).attr("title"), 

btw when i mean “failed”, there is no error, pop up, etc. The droppable just didn’t work (not active, not hovered, can not drop.).

I found lot’s of demoes or Q/A of this “accept”, but all of them are using something that can be defined before runtime. So the “accept” can use only constant value, or the way i’m using it was wrong?
Thanks for answer or recommandations or comments that may help.


According to the answer from Xnake, the way to do it was conclude to:

before the old code of droppable, add the first 3 lines:

        $("ul.droppable.accept").droppable({
            accept: function (e) { if (e.hasClass($(this).attr('accept'))) return true; }
        });
        $("ul.droppable").droppable({
            activeClass: "ui-state-default",
            ... //this is the old code.

That means if we give a “accept” class to the droppable ul, it will accept only object with some class; otherwise, it can accept any draggable.

Then in the view:

<ul class = "stories-of-category droppable accept" accept = "@map.Type" >
...
</ul>

if any object with class of the same name with @map.Type, it can be dropped here. For example:

<ul title = ".."> //this is another ul.
    <li class = "@map.Type">
        @map.Title
    </li>
    ...
</ul>
  • 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-05-23T12:42:27+00:00Added an answer on May 23, 2026 at 12:42 pm

    You can make accept in droppable() as a function instead and specify your criteria inside:

    accept: function(e){
        if(e.hasClass($(this).attr('title'))) return true;
    }
    

    Or shorter:

    accept: function(e){
        return e.hasClass($(this).attr('title'));
    }
    

    Thanks.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm making a simple page using Google Maps API 3. My first. One marker
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a text area in my form which accepts all possible characters from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.