This works fine but the link is located outside of the <li> tag which
causes the formatting to be weired. How can I generate this link and
position it within the <li> tag it is supposed to remove? I think the
answer might be very simple, i am just not clear about how to move an
elements while creating it.
Either way you’re going to have to amend your custom form builder. Your form builder is already outputting the
. If you’re doing it the second way (which I’d recommend as it’s more flexible) remember you can’t have <%= with do/end so you have to use concat to output the content if block_given? (within your input method).
Alternatively, you could do it with jQuery or something similar - give the link a class and then have a DOM ready event move any items with that class within the previous sibling.