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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:46:30+00:00 2026-06-10T05:46:30+00:00

I have a simple ordered list: <ol> <li>one</li> <li>two</li> <li>three</li> </ol> I’m using jQuery

  • 0

I have a simple ordered list:

<ol>
   <li>one</li>
   <li>two</li>
   <li>three</li>
</ol>

I’m using jQuery to make a sortable list where you can drag and drop to reorder items in the list. But I’d also like users to be able to delete list items by clicking an “x” icon where the ordered list number typically is on hover. The right side is already used by a “move” icon (three horizontal lines).

If I were hovering over list item 2, I would expect to see:

1. one
X  two     =
3. three

I need the 2 replaced with an X and it to be clickable.

(Note: the = above is meant to symbolize the move hover icon, typically three horizontal lines.)

  • 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-10T05:46:32+00:00Added an answer on June 10, 2026 at 5:46 am

    The problem is you won’t be able to change an ordered list into an unordered list (to just swap out the number into an X on the fly like that).

    Instead have an unordered list with the Numbers being laid out in span tags that we can swap out for the X (image / whatever you want). This way it’s easy to bind the delete event onto that as well!

    css ul li { list-style-type: none; }

    <ul>
        <li><span>1.</span> one</li>
        <li><span>2.</span> two</li>
        <li><span>3.</span> three</li>
    </ul>
    

    jsFiddle DEMO

    $('ul li').each(function () { 
        var this$ = $(this),
            _old = $(this).find('span').text();
    
        this$.on({
            mouseover: function () {
                this$.find('span').text('X');
            }, 
            mouseout: function () {
                this$.find('span').text(_old);
            }
        });
    
        this$.find('span').on('click', function () {
             if ( $(this).text() === 'X') {
                if (confirm('Are you sure you want to Delete?')) {
                    $(this).closest('li').remove();
                }
            }
        });
    });
    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple layout, just two un-ordered list by using <ul><li> ,
I have a simple, always-consecutive-ordered list like this: all = [ 1, 2, 3,
I have a a simple ordered list that could contain 1 million or more
I have very simple example of an un-ordered list with a black border, and
I have simple database - one table with 6 collumns. 3 of them i
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.
Suppose I have a list of things (numbers, to keep things simple here) and
I have a simple database with about 3900 entries, and am using a generic
I'm trying to style an ordered list that seemed quite simple but apparently is
I have a List object being accessed by multiple threads. There is mostly one

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.