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

What's the best approach for editing a question where the real problem in the question turns out to be a minor typo in the code? For example, this question where the user can't set an image via JS. The actual problem was using a [ instead of a ( in the code that selected the div, p, and img.

Do I leave it? Do I change the title to something like "Error selecting element"? Do I down vote it?

Edit

The OP has already answered and acknowledged the syntax error as the cause of the problem.

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

Since the OP has asked a question, it seems that he is unaware of the syntax or probably overlooked the bracket usage. In such cases you can just answer the question and ask OP if the bracket change is actually the answer or a typing mistake in the question. If OP feels that as proper answer, he will mark your answer as accepted, else he would reply saying it was a typo in question. In both cases you need not necessarily downvote the question since it was actually a genuine question from the OP.

In example you have provided, it is not a typo mistake but a genuine question for which the alternate bracket is the answer.

share|improve this answer
    
Yes, but the error has nothing to do with images, and the word images is in the title. Won't that be frustrating for users searching for problems with images when they open/read the question and it's just an issue of the OP using bad syntax? –  Robert Gowland Feb 25 '11 at 17:00
    
@Robert - It is, but you would not know that it is issue with bad syntax until OP confirms right? So before OP confirms, how can you edit his question title? This issue is same as that when you search on google too, you get lot of unwanted links, but you choose only ones you want to read right? This would be same way. –  Sachin Shanbhag Feb 25 '11 at 17:03
3  
I agree. Editing the posted code sample actually hides issues, it's better to just post an answer saying Hey, you forgot a ). Or, perhaps a comment, depending on the context of the typo. –  Tim Post Feb 25 '11 at 17:05
2  
To add to what Tim said... There's nothing wrong, in the long run, from pointing out the problem in a comment and letting the asker decide whether or not to simply delete the question. If it was indeed a typo in his original code (vs a transcription error), then there's no real value in keeping the question around; OTOH, you can't be positive he didn't have some other issue that is simply being masked by the typo until he confirms it - so ask for that confirmation (always a good use for comments). –  Shog9 Feb 25 '11 at 17:14
    
The OP has already answered and acknowledged the syntax error as the cause of the problem. Do we leave it up to the OP to remove the question, do we suggest to the OP to delete the question? –  Robert Gowland Feb 25 '11 at 17:21
1  
@Robert - The OP has also accepted the answer too. So I dont see any reason for him to delete the question since some user has put in that effort to make OP realize what the issue is. –  Sachin Shanbhag Feb 25 '11 at 17:30
    
@Robert: as I note in my answer, this specific case is a bit more involved than a simple typo. Regardless, he can't delete the question now anyway, so there's no point in suggesting that. Deletion is more appropriate for users who've realized their trivial mistake (perhaps with the help of comments) before anyone has bothered to post an answer. –  Shog9 Feb 25 '11 at 17:36
add comment

FWIW, the real issue in the example you post isn't a minor typo in the code - it's a fundamental misunderstanding of how the DOM API works. From the look of things, the user has tried to update some very old (pre-DOM) JavaScript to use getElementById without really understanding what that function does (or that it is a function...). Note that regardless of braces vs. parens, you don't chain calls to getElementById...

But back to your question: IMHO, this is one of those cases where you can do little more than try to make the patient comfortable. Do your best to make the title reflect the underlying problem ("Error retrieving image element" or the like), format it to highlight the source of the problem, and leave it at that - anyone wishing to help will have to do more than simply point out a typo.

In general though, actual typos are best addressed using the strategy Sachin and Tim describe.

share|improve this answer
add comment

Jeff weighed in on this a few weeks ago:

If [a question is] about "oops, I forgot to put a semi-colon at the end of a line", then I don't see any value in it, and it should be flagged for deletion.

So, don't bother editing. Leave a comment or an answer telling the OP about the error, and once the OP acknowledges or some reasonable amount of time passes, flag for deletion.

share|improve this answer
add comment

You must log in to answer this question.

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