retrieve onchange attribute

retrieve onchange attribute


Hello,
My (php) framework generates code with onchange attributes for selectboxes like:

<select id="example" onchange="alert('test')"> etc..

With jquery I need to retrieve the onchange string and pass it to a custom combo.

But  $("select[@id='example']").attr("onchange");
gives this:

 function onchange(event) {
    alert("test");
}

instead of:

"alert("test")"

What am I doing wrong?