Made the selection to be onchange instead of onclick