Form Field Onchange or Onclick - how to call Javascript function

To hide/unhide fields in HTML I am using styles and javascript function, called by ‘onchange’ or ‘onclick’:
<input id=“users” type=“radio”… onclick=“MyFunction();”/>

Now I’m trying to create dynamic form with Form plugin, where some fields will get hidden or not, based on radiobutton selection.

Can you tell me , how can I call Javascript within Form plugin, when radiobutton is clicked ( or value of field is changed)?

SOLVED

Script:

document.getElementById('myid').onclick = MyFunction;

did the job.
In this case Javascript must be renderd after content. Othervise it is possible to use JQuery script:

$(document).ready(function() {
    $('#myid').change(MyFunction);
});