Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Bind element to validation errors

Hi all,

I'm pretty new to JavaScript and I'm working with a very simple script which attaches and links a chat box/service to our site.

The resulting chat box is meant to allow those having trouble logging to chat with an employee who might be able to guide them through the process. It's native state is hidden like so:

hidden

The user can obviously interact and open the chat box revealing the following:

show

What I would like to do is have this chat box automatically pop-up suggestively offering to chat with an employee should the user's login attempts fail i.e. wrong password, wrong email, validation errors, etc.

Anybody have any thoughts on an easy way to do this, preferably through js/jquery?

Thanks all!