First get the index of the newly added model in the collection (after sorting). You can get it using the underscore method indexOf ie index = todoColl.indexOf(todo); .
Then use the selector: eq () jQuery to get the element currently at that position in the list and .before () your new element, i.e. $("li:eq(" + index.toString() + ")").before(view.render().el); (provided that the representation displays the element li). Caution, add code to control the case if the last element is the last (in this case, the jQuery selector will be empty).
source share