Works for me if I use the native setAttribute()
.
Also, remember that you need quotes around the selector.
$("#sel_id")[0].setAttribute("onchange", "foo_2()");
Also remember to define foo_2
in the global namespace, and not inside jQuery's .ready()
function.