What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 128 Stack Exchange communities.

I recently browsed this question about changing the appearance of an HTML select with CSS and HTML.

I was wondering when use JavaScript is an acceptable solution to a "how do I do X with HTML/CSS" question.

This is the most related question I found

share|improve this question
add comment

3 Answers 3

up vote 12 down vote accepted

When

  • there is no practical solution not using JavaScript
  • OP didn't explicitly ask for a non-JavaScript solution

Then, considering that JavaScript tend to be available everywhere, it might be considered useful to answer with a JavaScript-based solution. Of course it has to be a real solution, not simply the recommendation to "use JavaScript".

share|improve this answer
10  
Yes, but I'd also like to point out that just saying "use JavaScript" or "use jQuery" is not an answer. You do actually have to provide the solution in JavaScript/jQuery. –  animuson Mar 28 '13 at 22:39
1  
@animuson In fact I didn't even read the question like this. Of course this kind of answer would never be acceptable, as it's not really a solution. I edit my answer for more clarity. –  dystroy Mar 29 '13 at 6:58
add comment

I agree with Benjamin in that the question wasn't answered fully and that any answer that uses JavaScript here should at least allude to the reason why an alternative is either less preferable or impossible. However, I disagree with the idea of discouraging these kinds of answers outright, simply because sometimes the people asking the questions are thinking inside a box, and it's often hard to tell unless they say so explicitly.

For example, if someone posted a question about trying to align two elements horizontally and said, "Is there a general way to figure out how many
tags I need to make these words even with this picture," I'd hope that someone would alert the asker to the existence of better ways to do that with CSS.

share|improve this answer
1  
I disagree with you, but I'd just like you to know that I really appreciate that you came here and voiced your opinion on the subject. –  Benjamin Gruenbaum Mar 28 '13 at 20:17
1  
Likewise. And I like the way you phrased it here, because that's a broad topic and I know how annoying it is when the majority of advice you see amounts to discarding your requirements! –  atw13 Mar 28 '13 at 20:23
add comment

The same applies with people using JQuery in JavaScript questions. Mine (and I think others in the tag) go under the assumption that if the OP tags either JavaScript or JQuery, then they can be used.

Otherwise, either comment to say there's no CSS solution, or add that as an answer and provide a JavaScript alternative.

share|improve this answer
1  
That's not the same problem in my opinion : there is no case where a problem can be solved with jQuery and can't be solved without. –  dystroy Mar 28 '13 at 21:25
    
@dystroy True, but not everyone uses jQuery and some are against it. –  mattytommo Mar 28 '13 at 21:31
    
@dystroy true, but sometimes the no-library solution is veeery awkward (addEventListener, anyone? Or the luxury of textContent? Who uses Internet Explorer anyways? Not to mention implicit iteration as well as one-liner AJAX are pretty cool IMO) –  Jan Dvorak Jul 4 '13 at 20:31
add comment

You must log in to answer this question.

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