How to sort a <ul> by the value of an input in every LI

How to sort a <ul> by the value of an input in every LI

Hello,

i use a drag&drop-Plugin to sort lists. Now i would like to add a function to enter a numeric value, for very long lists, to place for example item 100 on third place.

So i put an input in every LI, and try to sort the LIs by there values- actual code at the bottom.

My problem is: how can i sort not by the "value" of the LI, but by the value of the input INSIDE the LI?

jQuery(document).ready(function () {

    jQuery(".single_item input.sort_input").change(function () {
alert ("WTF");
        jQuery(".sortable").html(

            jQuery(".sortable").children("li").sort(function (a, b) {
    
                return jQuery(a).val() - jQuery(b).val();
    
            }) 

        );

    }); 

});