What I would recommend is adding an HTML class for the type of widget you'd like to add ajax behavior, then you can add javascript behavior to the element based on the class, or HTML ID (automatically generated in newer openacs versions).
This is known as progressive enhancement. That is, make sure it works without javascript first, then add optional javascript behaviors.
Here is some background https://openacs.org/xowiki/ajax-accessibility
Not only does this make your site accessible, it is good form, seperation, and abstraction.