Javascript – removing a div and focusing input field next to it


my html is like this

  <input type="text" class="textinput" id="file_descr_0" name="file_descr[0]" value='' />
  <div id="mean" onClick="removeElement('mean');">{L_FileDescr}</div>

and to remove the div i am using this function

function removeElement(div){ 
    var d2 = document.getElementById(div); 
    var d1 = d2.parentNode;

I wanted to know how I can make this removing element dynamic because there are lot of divs which are to be removed and because of this function i will have to give each one a id.

and also after removing how can i focus the input field.

Thank You.

Best Solution

<div onClick="removeElement(this);">{L_FileDescr}</div>

function removeElement(d2){ 
    var d1 = d2.parentNode;

    // edit. also: