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.
I can't believe that I haven't heard of this module until now. Maintained by Joachim Noreiko, a very prolific module author, this module lets you create views where the values can be edited inline.
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:
A nice way to add placeholders to input fields.
"This module auto-converts form input fields with space-hogging labels into compact mobile-friendly input fields, with placeholders that animate into much smaller labels the moment text is keyed in. "
"Maxlength allows you to set maximum length of any field on any form making use of the form API. This includes fields created using the UI. (Example: any text field on a node)
The gist: "This module extends the functionality of the core 'file' field, adding new capabilities to the file upload widget, and providing a new extendible field formatter for displaying lists of files."