you are doing same many times so you should move it to function

also dont use global lookup `$` - use `this.$`