Section 508 is all about the UI, not the back end, so if you want to spend 10 lines of JS to make a text box with some words next to it, go ahead. All 508 cares about is that you have a label corresponding with the text box, and navigate to it via the keyboard. But I am assuming you want to do more fancy stuff. Since you are discussing fairly heavy-duty scripting, a lot of agencies will say you should check the output (or application) against the software standards as well. If you are familiar with the Standards, you should be complying with 1194.21, .22, .31, and .41. If you are working with an agency currently, speak to either the Section 508 Coordinator or their designee (many agencies have a help desk) to see how they test web apps/heavily scripted pages. If you are not working with an agency, but want to market your product to the US Federal Government, test your product against the standards I outlined. Also, it would be good to create a VPAT for your product.