Use change function and fix setInterval issue