Label inside – inscription in form fields with jQuery

    Label inside - inscription in form fields with jQuery

    This is often implemented in a way that the label in the value of the @ value attribute of input element or the content of the textarea element is set, the training and insertion is done by JavaScript. The technical implementation is problematic:

    • Caption and actual user input must be distinguished in the field and the text style (color) must be changed with JavaScript. Should also be pre-assigned fields are used, the distinction made in the markup (HTML).
    • If the JavaScript is running late, the user enters something into the field before its label was deleted. Thereby, the label text undesirable to a portion of the input.

    Circumvents this difficulty, if one realizes the labeling with the appropriate HTML label element. This is encapsulated together with the input field in a container element of the class “label inside”:

    Leave a Reply