You would use Javascript if you want the tooltip to change over the course of the form. For example, if you want to display a different tip after a button was clicked, then you would set the tooltip in the click handler for the button.
If the tooltip will never change, then just include it in the element.
solved Tooltips: JavaScript title manipula vs. title only