Skip to content

onEnd, How can I get the value of the first item in the list? #1989

Answered by owen-m1
sasori7 asked this question in Q&A
Discussion options

You must be logged in to vote

Of course it can have code in it, that's what its for :)
Try this (where el is the sortable element):

new Sortable(el, {
    onEnd: function() {
        console.log(el.firstElementChild.textContent); // Log text content of first child
    }
});

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by owen-m1
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants