Szmerd Szmerd - 7 months ago 27
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) {



$('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.