If instead of .vanish we use "div"


$(document).ready(function() {
$("button").click(function() {

Just one little doubt. If I use "div" inside the paranthesis instead of .vanish, will it not work in a similar manner?


What will that do to the specificity?


If you use 'div', you will targets all <div> tags on the site. That is generally a bad idea.


all DIVs anyways contain .vanish right? Then how is it any different?


all div's contain .vanish


Careful how you use that word 'all' around programmers. They might rush the open bar.

The definition of 'all' in programming is literal; it is not something to be trifled with.


oh I didnt knew that. Really sorry if it was offensive. It was highly unintentional. But can you help solve my query now?


It was not offensive. I was jesting.


Is there present a BUTTON element and a group of elements with class, 'vanish'?


In this case - maybe. In every code you will ever write? I doubt it so much that I can say 'no' for sure. Don't learn the bad practice, it's great you think of other ways to tag everything that has class 'vanish' on it. But if you want div elements that also have vanish, you can do this $('div.vanish').

Your code seems right, so I'm guessing you managed to pass the exercise? If not, what's the problem mate? Show us your html code, you already showed javascript and it's fine.


I passed the excericse even before posting this question. My intention for posting this question was due to other reasons. But I understood. Thank you all for the support. :slightly_smiling: