You need to ShowSomeEffort. You haven't told us what the problem is except that you don't know how to "achieve it", but your code shows that you actually do know how to achieve it. So what is the real problem?
Are there errors messages on the console? Have you set breakpoints to see if your code is getting called at the right times? If so, are the variables containing the correct values? Do your jQuery selectors actually return what you expect?
These are the typed of debugging steps you need to take.