how to write this in proper javascript way;

function check_selected_button(){
if buttonA.clicked
open in a new window
else doNothing
}

<% submit_tag "ButtonA" %>