So I'm trying to build a little editor, a bit like the one I'm typing in right now .

Right now I've something like this:
<input type="button" class="tagbutt-B" onclick="insertTag(this, 'my-textarea-id');"
And it works fine. But what I'd really like is to get rid of is the textarea id in that. I'm imagining the function I'm looking for would have to do something like:
  • Find the fieldset 'this' is a child of
  • Find the first textarea or text input field within this fieldset
Well, eh, that's it really