SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Select Numbers in Ordered List

    I have some ordered lists on a webpage. When I select the list and copy it, I want the numbers to appear when I paste the content in a textbox. Right now, it just pastes the text without any mark to show a new line.

    How can I include the numbers when I select and copy the list?

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,615
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    Are you just copying the text from the browser display? It won't work, because the numbers are not part of the text. They are generated by the browser. To be copyable text, the numbers would have to be in the text itself. E.g. in an UL, you'd have

    Code:
    <ul>
      <li>1. first</li>
      <li>2. Second</li>
      <li>3. Third</li>
    </ul>
    Then you'd have to style the UL not to include the default dots. Bit of a mess, really.

  3. #3
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,740
    Mentioned
    32 Post(s)
    Tagged
    1 Thread(s)
    Actually this is browser dependent, some some browsers copy their out put as plain text some dont.

    A SIMPLER SOLUTION: COPY to a file that RTF format, then convert that to plain text if needed

    As Ralph pointed out the #s ( or bullets in OLs) aren't really part of the content TEXT, and the context of UL/OL doesnt get copied into plaint text, but it does into Rich Text.

    If you are coding and worried about it not retaining the #s you could do something like this:

    Code:
    ol{list-style: none;   counter-reset:items;}
    li {counter-increment: items}
    li:before {content: counter(items) ". ";}
    
    
    <ol>
    	<li>item</li>
    	<li>item</li>
    	<li>longer sample item</li>
    	<li>item</li>
    	<li>item</li>
    </ol>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •