Similar to this question but not quite the same. What are people's thoughts about posting a jQuery solution as an answer to a question, when the question doesn't indicate jQuery, only Javascript?

My 2cents: post a Javascript solution or ask in the comments if jQuery is acceptable. I'm a fan of jQuery myself but I also enjoy coding in plain old Javascript, I think even more so now that jQuery has emerged because I feel like it's more of a niche. Seems that plain Javascript is becoming less used on SO and pretty much any DOM related question has a jQuery answer.

Example question.


It's fairly typical to see Javascript questions where the author makes it clear that they can't or won't use jQuery for whatever reason. Obviously, an answer suggesting jQuery would not be helpful or well received there.

As far as questions that really don't specify a preference in either direction, just give it your best answer.

Just beware, many would frown upon an answer to a question not specifically looking for jQuery that suggested loading jQuery to do something extremely trivial like hiding a div. In another language, that would be like suggesting one use bcmath to add three trivial integers together.

Your best judgement, as always, should be exercised.

  • 1
    +1, I think your comment about trivial functions is key here. – MrCode Dec 7 '12 at 11:43

You should provide a helpful answer. If using jQuery in your answer would be helpful, use jQuery.

The OP can always indicate that they are not 'supposed' to use jQuery (e.g. they are cheating on their homework), or give other reasons not to use jQuery to indicate your answer wasn't helpful to them.

We see the same issues in other languages. There always will be questions where an external library is the best practice to solve the class of problems. Just use those best practices when answering.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .