Here are some examples of using Drupal's states API. It shows the use of OR and XOR (which only work with jQuery 1.8 or above, apparently). More examples can be found in the examples project in the form example module.
There are contributed modules that will help with this that are listed below. You can also use Form API's #attributes to add in an HTML5 placeholder.
Here's an example using Drupal Form API: