javascript-how to dynamically increase the order of elements?

Source: Internet
Author: User
Keywords JavaScript PHP front-end jquery
javascriptphp Front-end jquery

     
   
       JQuery Test        Click
   
   
   

    Click Add Li, click Delete to update the Li inside the number and attribute ID, but the increase or in the original order to increase, how to change it?
    Cases:
    1------Delete
    2------Delete
    3------Delete
    4------Delete
    5------Delete
    6------Delete
    7------Delete
    8------Delete
    9------Delete
    Delete------

    Click Delete to change the number dynamically:
    1------Delete
    2------Delete
    3------Delete
    4------Delete
    5------Delete
    6------Delete
    7------Delete

    Then click Add:

    1------Delete
    2------Delete
    3------Delete
    4------Delete
    5------Delete
    6------Delete
    7------Delete
    ------Delete
    Delete------
    Delete------

    Increased because it is n++ determined, so there is no dynamic change

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.