In the first two you linked to, i think the other answer was indeed better. In this one, you just say "try this" and give some code, while the other user explained it. In this, you did explain, but apparently the OP found the other one better.
These two i think you did write well; +1 from me.
But in the end, it's all up to the asker to decide which one helped them the most. And yes, it is possible that some people prefer to accept high-rep users' answers, due to perceived better knowledge.
Myself, if it's a choice between upvoting a high-rep user and a low-rep user, i'll give the lower user the +1 if the answers are of equal value.