Thanks guys! I knew there had to be a simplier way of doing this. I had come up with a solution but it was a bit hacky, this is much cleaner. I will give it a try in my app.
Yue, you said to view the live demo in Chrome. Why is that? Will the functionality not work in other browsers or is it just jsbin?