I struggle with some task. When I focus on input, the value of other inputs should be cleared. Unfortunately my logic inside the loop fails. Why?

\*\*\*\*\*EDITED\*\* ([Rocket Hazmat](https://stackoverflow.com/users/206403/rocket-hazmat) tip)

```
function emptyInputArea(e) {

    if(e.target.tagName === 'INPUT') {

        currentElem = e.srcElement;

        for(var i = 0, total = inputs.length; i < total; i += 1) {
            if(currentElem.getAttribute('id') === inputs[i].getAttribute('id')) {
                currentIdx = i;
                console.log('current index: ' + currentIdx);
            }
            //while(i !== currentIdx) {
                //console.log('show inputs for clear: ' + i);
                //inputs[i].value = "";
            //}
            if(i !== currentIdx) {
                console.log('show inputs for clear: ' + i);
                inputs[i].value = "";
            }
        }
    }
}

```

**Full code [here](http://jsfiddle.net/cachaito/DaGQZ/8/)**