How can i select same name Radio button with java script? : I have multiple radio button with same name and id and want to select radio button with javascirpt .

    <input type="radio" name="Custom.SELECTED_INDEX" id="Custom.SELECTED_INDEX" value="1" class="middle"> 

    <input type="radio" name="Custom.SELECTED_INDEX" id="Custom.SELECTED_INDEX" value="2" class="middle"> 

    <input type="radio" name="Custom.SELECTED_INDEX" id="Custom.SELECTED_INDEX" value="3" class="middle">

I am trying with below code but that is not working 

(function() { document.getElementById('Custom.SELECTED_INDEX')[2].checked =  true; return 'success'; })();

    