There is no recommended behaviour on this manner, you can not do this without user intervention or without automatically altering the TPL files (which can lead to issues if not done correctly, or if the theme has big differences from the default one).
What I mean by both is you can let the user choose which of the methods to use, in the configuration form of your module:
1. If he knows how, let him modify the tpl file manually;
2. If he does not know how, use the javascript method but inform him about the consequences.