Szmerd Szmerd - 1 year ago 94
Javascript Question

Click on element and move to first place in the list

I'm haveing problem to complete the click handler,which moves the clicked element to the first place in the list. And if I click B list should be reordered to B A C

eg. list


And i started with

function regh() {
$('ul li').click(function (event) {


Answer Source

$('ul li').click(function(event) {
<script src=""></script>

Use .prepend()

Description: Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download