The reason why the old code is not working is that $('#range-id input[type=number]') may not exist on the page when you are looking for it. In this case it is just not there on $(document).ready. When elements are added dynamically with JS instead of adding the action to the element you need to add the action to the document with the selector target.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users