Michal Čihař a écrit :
In this case you can append to #li_select_theme in case it exists. Usually there is simple way to write condition in javascript [*] and it makes things much simpler (it avoids mixing up different languages in single file, what tends to be confusing).
The best reason for this is to separate used languages in separate files. With PHP you're already mixing up HTML and PHP what we would like to avoid through using templates. Adding JavaScript into this mixture just makes the code more confusing and harder to read.
[*] I'm quit customized to mootools so I can not provide example for jQuery, but I doubt it is hard.
Indeed it's very easy in jQuery. Done for main.php,