JQuery Beer FAQ Tutorial
Disable Click Events
Section 3, Lesson 6

JQuery Beer FAQ Tutorial
Disable Click Events
Section 3, Lesson 6

 

This is the last lesson for the JQuery Beer FAQ tutorial. You have one more change to make.

You may have noticed you can click on selected FAQs on the question line. When you do the FAQ closes. However your code changed the cursor so it is not a hand cursor. SO the user is not expecting that to happen. So you just need to prevent the click event from occuring.

Another alternative is to keep showing the hand cursor and allow the FAQ to close when clicking the question line. That is a matter with design. For our tutorial we will disable the click event to learn more about coding.

Live Screenshot Web Browser

Insert the highlighted lines 14 and 26 in the index.html file in your practice folder. Indent the code between since we are creating a code block. Then save the file.

Source Code

This wraps the entire faq-question class element click handler with the if block starting on line 14. You use the hasClass method to see if the element contains the faq-question-selected class.If this is not true we skip running all the code that closes the FAQ answer and restyles the elements.

Source Code

This is the completed site.css file for this tutorial. There are no changes from the previous lesson.