sorting - Sequence divs using javascript onclick -


is there way click on div , save click sequence value in db.

say have ten items in 10 small small divs , want them sorted in sequence click on them. clicking on first 1 sorted first , next , next.

want able javascript. have seen happening in desktop application form fields sequenced tab order click on fields.

i can give conceptual format, because full-fledged deal quite long, , because you've posted no code.

  • ensure each div has unique id, , has @ least 1 common css class e.g. sortable - critical, allow query dom elements further sorting. and, regarding ideas id of divs, have seen variations of identifier post id database;

  • you have listening function run when window loaded, listens when div has class sortable clicked. override default action, , use class in tandem div id keep record of elements clicked , sort them accordingly whatever criteria deem fit (id, date, content). however, have manipulate dom modified represent new ordering. can done in 2 further ways:

    • your sort can real-time (which laborious , involves higher ram usage , lot of dom manipulation, doable).
    • or, option 2: perform static sort information passed via form page, redirects same page or new page reordered dom. way of doing purge dom tree , rebuild in same page javascript using sorted information upon submission of form, or click of button.

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -