Click the button to add content to the top section of the div using jQuery

Looking for some assistance with a web development issue I'm facing. Here's the scenario: I have two sections on my webpage - TOP and BOTTOM. In the bottom section, there are 3 list records each with a checkbox and button.

What I need help with is when I click on the button, the selected record should be added to the TOP section.

If anyone could provide guidance or solutions, it would be greatly appreciated. Thank you in advance!

http://jsfiddle.net/u74Ag/79/

Html code

   
       <div style="border:1px solid #eee;">
            <ol style='list-style:decimal;border-bottom:1px solid #e7e7e7;' id="sortable">
    
            </ol> <br/>
        </div>
        <br/>
    
    
        <div>
                <ul id="draggable">
                    <li style="height:auto;padding:5px 0;line-height:normal;border-bottom:1px solid #e7e7e7;list-style:none;">
                        <div class="qitem" style='margin-bottom : 20px;'>
                            <label>
                                <input class="hello" type="checkbox"/>Value 1
                            </label>
                            <button class="hello" style="float:right;">Add To Top Section</button>
                        </div>
                    </li>
                    <li style="height:auto;padding:5px 0;line-height:normal;border-bottom:1px solid #e7e7e7;list-style:none;">
                        <div class="qitem" style='margin-bottom : 20px;'>
                            <label>
                                <input class="hello" type="checkbox"/>Value 2
                            </label>
                            <button class="hello" style="float:right;">Add To Top Section</button>
                        </div>
                    </li>
                    <li style="height:auto;padding:5px 0;line-height:normal;border-bottom:1px solid #e7e7e7;list-style:none;">
                        <div class="qitem" style='margin-bottom : 20px;'>
                            <label>
                                <input class="hello" type="checkbox"/>Value 2
                            </label>
                            <button class="hello" style="float:right;">Add To Top Section</button>
                        </div>
                    </li>
                </ul>
            </div>
    

JQuery Code


        $(document).ready(function() 
        {
            $("#sortable").sortable({
                    revert: true,
                    refreshPositions: true ,
                    helper : 'clone',
                    tolerance: 'pointer',
                    revert: 20
            });
    
            $("#sortable").disableSelection();
    
            $(".qitem").draggable({
                tolerance:"pointer",
                helper : 'clone',
                refreshPositions: true ,
                revert : 'invalid',
                opacity:.4,
            });
    
            $("#sortable").droppable({
                revert:true,
                hoverClass : 'ui-state-highlight',
                greedy: true,
                refreshPositions: true,
                drop : function(ev, ui) 
                {
                    $(ui.draggable).clone().appendTo(this);
                    if($(this)[0].id === "sortable")
                    {
                        console.log($(this).closest("button").find('.hello'));
                        $(this).find('.hello').hide();
                        $(this).find('.AH_section').show();
                        ui.draggable.draggable( 'disable' ).closest('li').prependTo(ui.draggable.closest('ul'));
                        return true;
                    }
                }
            });
        });
    

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

In what ways can you toggle the visibility of table rows and data dynamically with the onchange event in HTML?

I'm dealing with an HTML code that can dynamically change table data based on user selection. Here's the snippet of my HTML code: Select an option: <select name='set' id="set" class="selectpicker" onchange='displayFields(this. ...

`Vue function is unable to find the definition of a variable`

I am struggling with utilizing a variable in a vue 3 application that has been emitted by a component called Mags. The variable is functioning properly in the importMags function, however, I am unable to access it within the handleSubmit function. It consi ...

Generate a vector3 with a defined direction

I have a challenge at hand where I am looking to create a 2D flow field in three.js based on a working example I found in p5.js. The original source code for reference is as follows: var inc = 0.1; //Increment of noise var yoff = 0; var scl = var; //Scale ...

Example of material-ui-pickers: Error - Object(...) is not a function

Trying to implement a basic material UI pickers example using a clean project and following the installation and usage instructions provided here: An error message is displayed as follows: TypeError: Object(...) is not a function Module../node_modules/@m ...

Methods for delivering static resources on multiple routes in Express JS

Is there a way to effectively serve static resources for all routes in Express JS? I attempted to serve files with static resources using the following code snippet: app.use(Express.static(`${this.PATH}`)); app.use(Cors()); app.use(Express.json()); app.g ...

Select values to Component from an array contained within an array of objects

Each user possesses a unique list of tags, and every item owned by the user can be associated with multiple tags from this list. In this scenario, I am attempting to display all the tags belonging to a user for a particular item. If the item has a tag tha ...

Issue with error handling not being triggered when calling SAPUI5 function()

IBAN validation within a SAPUI5 Wizard is causing some issues for me. I am utilizing a functionImport on a V2 ODataModel (sap.ui.model.odata.v2.ODataModel) to perform this validation. Despite receiving a 202 status code, the request actually failed. Here ...

Invalid argument type and beyond acceptable range: file:///c:/Tools/MYScript.hta

My task involves creating a script to query an MSSQL database and display its content. However, I keep encountering the error message stating Argument wrong type and that it is out of acceptable range. Can someone please assist me with this issue? Below i ...

What is the best way to calculate the variance between the most recent and previous data points in an array in the span of an hour using JavaScript

Here is an array of objects I am working with: 0: {time: '2021-12-02T23:53:54.062Z', value: 558316} 1: {time: '2021-12-03T00:53:53.959Z', value: 558452} 2: {time: '2021-12-03T01:53:53.934Z', value: 558588} 3: {time: '2021 ...

Incorporate the slick-slider functionality smoothly into a WordPress website by utilizing JavaScript

I am fairly new to .js and currently attempting to incorporate a .js slider into my Wordpress site. I have been working on getting Slick-Slider operational on a website. While it functions perfectly fine on my static webpage, the transition to Wordpress ha ...

Leveraging icons with Bootstrap 4.5

I am currently exploring how to incorporate Bootstrap 4.5 icons using CSS. Do you have any examples of code that could guide me on how to achieve this? I am specifically interested in understanding the required CSS declarations that would allow me to use t ...

Creating an Angular table row that can expand and collapse using ng-bootstrap components is a convenient and

I need assistance with an application I am developing, where I want to expand a table row to display details when it is clicked. The issue I am facing is that currently, all rows expand and show the data of the clicked row as seen in the image result below ...

issue with jQuery not properly selecting options based on text

I have three select elements in my code, each containing 3 or 4 options. An "Apply All" button is placed on the first file row. When a user selects a sheet name on the first file and clicks the Apply All button, it should automatically select the same she ...

A flashy Rickshawgraph with the ability to modify the background color of the top data series

I am facing a challenge in modifying the background color of the rickshawgraph widget in dashing based on the maximum value of the highest graph from the latest incoming data. While I have successfully implemented this feature for one series, I am struggli ...

stopping a float-left div from being pushed down by a table

I am facing an issue with two float:left divs that are supposed to stack left-to-right. One div is a fixed width left nav, while the other should span the remaining width of the browser. The problem arises when there is a table in the second div with multi ...

Modify the role attribute on elements in real-time to enhance accessibility

On a German website, we have implemented a textfield with autocomplete functionality in a form. As the user types into the input field, a dropdown menu of suggestions appears for them to select from. It is crucial that this feature is fully accessible with ...

Storing props in JSX components using variables in React.jsLearn how to set props in JSX components and

If I have already created a component: class Co extends React.Component { render = () => { const name = this.props.name; return ( <p>Hello, my name is {name}</p> ) } } and stored it in a variable ...

Unfortunately, Rem fails to honor the preferences of users on their smartphones

Trying to incorporate rem units to respect user-defined font-size: Initially, I included the following line in my CSS file: html { font-size: 62.5%; } Subsequently, I applied font-size using rem units to my element. For example: .header{ font-size: 1.5 ...

What is the method for showcasing an image before it has been uploaded?

I must start by apologizing for my English, as I am not the most fluent speaker. Here's where I'm facing a dilemma: I have created an application that allows users to edit questions for a game. These questions are stored on a server and can be ...

Button triggering an onclick event

Can you design a feature where clicking on each button reveals specific images with text and heading? The initial image is hidden and when another button is clicked, the previous image disappears and new one appears in its place. We would like to achieve t ...