drupal_add_js does not add javascript on after_build I'm using the following line to add JavaScript code to my module form:

$form['#after_build'][] = 'myModule_after_build'


In myModule_after_build(), I add the Javascript code with calling drupal_add_js('myJavascript','inline'). 

Unfortunately, it seems that the JavaScript code is added only during the first page call.
I would like to pass some arguments to JavaScript, and manipulate the content of the JavaScript, according to the options in the form.  

Is there any configuration that I can set to add 'myJavascript' with different arguments to every button click?
#after_build is called every time the form it built. I've used this myself many times to add JS to forms. Most likely you have a flaw in the script or after build function itself, or you are using cached data when creating the script to display.

If you posted your code, we could provide a better answer.