Remove jQuery dependency for custom select improvement

Added a utility function to replace prevAll(selector)