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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:28:12+00:00 2026-05-23T17:28:12+00:00

I am trying to make a draggable select option and when that is dragged

  • 0

I am trying to make a draggable select option and when that is dragged to the Main Content Area i add two controls to that One to delete the Dragged Element and Other for Its Properties. The Html for the draggable select is like

<div class="demo">
<div class="tools"> 
<ul>
    <li class="draggable" >
     <div class="control">
      <label class="orig">&nbsp;</label>
      <select><option> Select Option</option></select>
      <div class="delete" style="display:none"><sup>x</sup></div>
      <div class="properties select" style="display:none">Properties</div>
     </div> 
    </li>
 </ul>   
</div>        
</div>

When the Select Control is dropped i have the following code which runs to add the properties and delete options to it

$('.select').live('click', function() {
        var label = $(this).parent().find('label').html();
        $("#select_label").val(label);
        var option = $(this).parent().find('select').children();
        $( "#dialog-select" ).dialog( "open" ).data('parent_div',$(this).parent());
        $('#add_more').live('click', function() {
        if(($(this).parent().prev().find("input").val()) == "")
        {
            alert("Please enter a value for option");
            $(this).parent().prev().find("input").focus();
            return (false);
        }
        else{// Add another option field to the form
            $(this).parent().prev().after('<fieldset><label for="select_option">Option</label>      <input type="text" name="select_option" class="text ui-widget-content ui-corner-all" /></fieldset>');
            }               
        });         
        return false;
});

This adds a X (to delete the Element) and a Properties Link to the Select Option.
When i click on the Properties the Following Form is opened in a modal dialog

<div id="dialog-select" title="Select Properties" style="display:none">
<form>
<fieldset>
    <label for="select_label">Enter Label </label>
    <input type="text" name="select_label" id="select_label" class="text ui-widget-content ui-corner-all" />        
</fieldset>
<fieldset>
    <label for="select_option">Option</label>
    <input type="text" name="select_option" class="text ui-widget-content ui-corner-all" />     
</fieldset>

<fieldset>
    <input type="button" name="add_more" id="add_more" value="Add More Option" />
</fieldset>
</form>

This Accepts from user a Label and Options for the Select Options,

When the User Adds some options and a label and click on the apply button the following code is executed.

 $("#dialog-select").dialog({
                        autoOpen: false,
                        height: 300,
                        width: 350,
                        modal: true,
                        buttons: {
                                "Apply": function(){
                                    var label = $("#select_label").val()
                                    var $elem_clicked = $("#dialog-select").data('parent_div'); 
                                    $elem_clicked.find('label').html(label); 
                                    // I need something to do here
                                    $( this ).dialog( "close" );                                        

                                    },
                                Cancel: function() {
                                            $( this ).dialog( "close" );
                                        }
                        }
                         });

NOW the problem is that what the user has added in the Options is not getting added to the select Options which was dragged to the content area.
As you can see here http://jsfiddle.net/bilalkhan/D7pMT/4/ that the label is updating but i can not figure out how to Add/Edit the options that the user has Added in the Dialog Form.
Please help me with this issue..

  • 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-23T17:28:12+00:00Added an answer on May 23, 2026 at 5:28 pm

    I have sorted out how to add that here is the code

     // Add the Options to the Select Element Here
                                        $('input[name=select_option]').each(function(){
                                            // get the Values of options here
                                            $(this).attr("value", $(this).val());
                                            if($(this).val() != "")
                                            {// if the option is not empty
                                                // add options to the select element
                                                $elem_clicked.find('select').append('<option value="'+$(this).val()+'" >'+$(this).val()+'</option>');   
                                            }
    
                                        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a make generic select control that I can dynamically add elements
I'm trying to make a function that takes two data types, each of which
I am trying to make jquery add new div and then make it draggable
I'm trying to make a list item draggable in a project that is using
Trying to make a custom :confirm message for a rails form that returns data
While trying to make one of my python applications a bit more robust in
Im trying to make a function that will return an element of type point:
I'm trying to make an optional draggable div, which shows up at some condition.
I am trying to make a mobile app that would allow a drag and
I'm trying to use draggable/droppable in a manner that allows you to drag and

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.